I am trying to find a better solution to more dynamically loop through a cell with a Dynamic list of values from a Database Connection. The cell "B3" has a drop-down list of the items I want to loop through, and when a particular item is selected it refreshes the worksheet to reflect that items values (Select * from Table where Item = X). The number of items changes per quarter, as the items are the list of properties we appraise. Sometimes there are 50, sometimes 5 items. How do I modify this code so I do not have to go into the Macro and update the For i = 1 to 49 loop? I want is so it just can either query the item list and find the number of items or does a Do While loop and loops through all the values until the last one.
Dim strfindrow As String
For i = 1 To 49
Range("B3").Select
strfindrow = "=DATA_PROPERTY!R[" + Trim(Str(i - 2)) + "]C[-1]"
ActiveCell.FormulaR1C1 = strfindrow
Range("B3").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Next
End Sub