[RESOLVED] Populate Tabstrip
I have a userform with a tabstrip in it. The tabstrip has a variety of labels, text boxes &c that are supposed to slurp up information from an excel worksheet. In the code that follows the captions for the tabs are values from the first column of the spreadsheet and there are two text boxes that are supposed to take values from the 4th and 5th columns. Each tab is meant to have data from a separate row of the spreadsheet.
The problem is that while the coding for the tabs works, the values in the text boxes only pick up the values for the largest value of i, regardless of which tab I click on.
Private Sub UserForm_Initialize()
Call Tab_Name
End Sub
Sub Tab_Name()
Dim i As Integer
Dim fecha(6) As Date
Dim amt(6) As Currency
For i = 0 To TabStrip1.Count - 1
TabStrip1.Tabs(i).Caption = Sheets("Sheet1").Cells(2 + i, 1)
fecha(i + 1) = Sheets("Sheet1").Cells(2 + i, 4)
amt(i + 1) = Sheets("Sheet1").Cells(2 + i, 5)
txt_date = Format(fecha(i + 1), "dd-mmm-yy")
txt_amt = Format(amt(i + 1), "$###,##0.00")
Next i
End Sub
In other words, how do I get the information that the user sees when they click on tab1 to correspond to the information in row 2 of the spread sheet, the information they see when they click in tab2 correspond to row 3 of the spread sheet, etc?
Also, how do I code to add another tab to a tabstrip?