Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there anything like SQL's "Where" clause in VB?

Status
Not open for further replies.

Twiddler

Technical User
Jan 11, 2004
7
0
0
US
Probably a stupid question, but I have a list of almost 9000 non-series numbers in a column in Excel. I would like to add data on the same row as a specific number.

I could scan through the whole list to find it, but I'm afraid that it will slow my application down to a crawl.

Is there anything similar to SQL's "where" clause in VB?
 
Hi
I'm not up with too much SQL but it sounds like you're looking for the Find method. If you have more than one occurrance (or expect you may have) of each number then you will have to use the FindNext method too (will involve looping.) I never remember how to do this as it is one of the better examples given in VBA help, so I'd suggest checking that out.

If I'm a million miles away from what you're looking for, let me know and I'll see if there's anything else I can think of! Maybe working with filters?

Happy Friday
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
Loomah's right.

Record a Find macro with your criterion and then use
ActiveCell.Offset(0, 1)=your desired value in that row.

0 stands for the row offset. As you want to stay in the respective row it is 0.

1 is column offset, so in this case you assign the value to the right next cell. 2 would be two columns further...

MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Thanks to both of you. I ended up writing a nested For-Next loop to solve the problem and was quite surprised at the speed. I will rewrite using each of the two methods you've shown and let you know what gives me the best results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top