I am looking to find only certain records and handle them accordingly. I have a table called Locations
and one of the columns is labelled Location
. Currently my code handles ALL locations when I run the macro; however, I would like to write a variation of the macro that runs only certain locations (a range). The location values are all 2 letters followed by 5 numbers.
Example: CA10020
What I want to do is prompt for the starting and ending location values and then process only those ones. Example: CA10001 to CA13240 Everything before and after those values would be ignored... but those values AND everything between them would be handled.
Normally I have a good idea where to start and through trial and error I can figure out the rest. In this case I am stumped on where to begin. As you can tell, I am not a VBA expert.
I currently have this code which handles ALL the records which is not what I need to do now:
For i = 1 To Range("Locations").Rows.Count
Range("F3").Value = Range("Locations[Location]")(i)
'I have other code here that handles the new value of cell F3
Next i
UPDATE: I added this code:
Dim Start_Location As Variant
Dim End_Location As Variant
Start_Location = InputBox("What is the starting location?")
End_Location = InputBox("What is the ending location?")
...but I have no idea how to handle those values now.