IF STATEMENT
-
Hello, I am new to VBA (self taught) and I'm looking for a shortcut on writing an IF STATEMENT. I have an Excel spreadsheet that contains 3,070 rows of Bin Numbers. The report is similar to the below columns. 510250000 510250999 510251000 510251999 510252000 510252999 510253000 510253999 Soon I will receive a report on a daily basis, which will need to be bumped next to these bin numbers looking for a match. I wrote the following IF STATEMENT If strbin >= 510250000 and <= 510250999 _ or strbin >= 510251000 and <= 510251999 _ or strbin >= 510252000 and <= 510252999 _ then Cells(irow, 1).Interior.ColorIndex = 34 As mentioned above, by the time I've completed the above statement I will have over 3,000 rows. I would appreciate any feedback on a shortcut. Thank you in advance for your help. Fountain
-
Hello, I am new to VBA (self taught) and I'm looking for a shortcut on writing an IF STATEMENT. I have an Excel spreadsheet that contains 3,070 rows of Bin Numbers. The report is similar to the below columns. 510250000 510250999 510251000 510251999 510252000 510252999 510253000 510253999 Soon I will receive a report on a daily basis, which will need to be bumped next to these bin numbers looking for a match. I wrote the following IF STATEMENT If strbin >= 510250000 and <= 510250999 _ or strbin >= 510251000 and <= 510251999 _ or strbin >= 510252000 and <= 510252999 _ then Cells(irow, 1).Interior.ColorIndex = 34 As mentioned above, by the time I've completed the above statement I will have over 3,000 rows. I would appreciate any feedback on a shortcut. Thank you in advance for your help. Fountain
Uhhh...Your IF statement doesn't have to be multiple ranges like that, because, so far, your range is 510250000 to 510252999, with no breaks between the ranges you listed! What's the logic behind what you want to do? So far, all we've seen is that your coloring cells, but why? What determines what color the cell is going to be? And what is the problem that your having? Is it performance related? RageInTheMachine9532