Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 29th, 2012, 03:33 PM
cmorse723 cmorse723 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 8 cmorse723 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 56 m 58 sec
Reputation Power: 0
Vlookup Excel VBA

The premise of my code is to run a macro after a user inputs the data then they can run the macro to lookup the text in cell B9 to B400 to find the # corresponded with that text on another sheet.

Right now i'm running it and just getting "Not found" in all my specified cells.

Any recommendations?


Code:
Public Sub vlookup()
Dim rng As Range

h = 9
Do While h < 400

Cells(h, 4).Value = Application.[VLookup(Worksheet("Resource Load Breakdown").Range(h, 2), Worksheet("PlanIT #'s").Range("A2:B400"), 2, True)]

If IsError(Cells(h, 4).Value) Then
Cells(h, 4).Value = "Not Found"

End If

On Error Resume Next

h = h + 1
Loop


End Sub

Reply With Quote
  #2  
Old May 30th, 2012, 12:36 PM
cmorse723 cmorse723 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2011
Posts: 8 cmorse723 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 56 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by cmorse723
The premise of my code is to run a macro after a user inputs the data then they can run the macro to lookup the text in cell B9 to B400 to find the # corresponded with that text on another sheet.

Right now i'm running it and just getting "Not found" in all my specified cells.

Any recommendations?


Code:
Public Sub vlookup()
Dim rng As Range

h = 9
Do While h < 400

Cells(h, 4).Value = Application.[VLookup(Worksheet("Resource Load Breakdown").Range(h, 2), Worksheet("PlanIT #'s").Range("A2:B400"), 2, True)]

If IsError(Cells(h, 4).Value) Then
Cells(h, 4).Value = "Not Found"

End If

On Error Resume Next

h = h + 1
Loop


End Sub


Any help?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Vlookup Excel VBA

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap