I am using userforms and modules, and the following code works perfectly when I set the sheet name to whichever sheet I want (e.g. Product1, Product2, etc). However, I have lots of sheets (54 currently) that I need to reference, and would like to be able to create a dropdown box to select the list of sheet names. If I manually change Product1 to Product2, then it references the 'Product2' sheet perfectly fine, but I don't want to create 54 (and counting) separate buttons, and would like to have a pop up box when the userform opens that the user can select 'ProductXXX', and the relevant sheet is referenced. Is there a simple way of doing this?
Sub ResetDB3()
Dim iRow As Long
iRow = [Counta(Product1!A:A)] ' identifying the last row
With frmFormDatabase3
<other code not relevant here, and ending with...>
If iRow > 1 Then
.Database3.RowSource = "Product1!A2:P" & iRow
Else
.Database3.RowSource = "Product1!A2:P2"
End If
End With
End Sub
Sub ResetDB3()
Dim iRow As Long
iRow = [Counta(Product1!A:A)] ' identifying the last row
With frmFormDatabase3
<other code not relevant here, and ending with...>
If iRow > 1 Then
.Database3.RowSource = "Product1!A2:P" & iRow
Else
.Database3.RowSource = "Product1!A2:P2"
End If
End With
End Sub