L
Lucas Steiner
Hello,
I have a simple spreadsheet that gathers data from a data input userform
I've created. After all the data is input I want to be able to call another
userform that will allow me to scroll through the data line by line and
display the data in labeled text boxes. I have the userform all set up and
all the boxes named appropriately but for some reason my GetData sub is not
working. Basically if the user selects row 3 I need to have all the data
pulled from row 3 and placed in the appropriate boxes on the userform for
review. Code is below, any help greatly appreciated!
Code block
Private Sub GetData()
Dim r As Long
If IsNumeric(RowNumber.Text) Then
r = (RowNumber.Text)
Else
ClearData
MsgBox "Illegal row number"
Exit Sub
End If
If r > 1 And r <= LastRow Then
EquipmentID.Text = Cells(r, 1)
Nomenclature.Text = Cells(r, 2)
InspType.Text = Cells(r, 3)
InspInt.Text = Cells(r, 4)
DateLastInsp.Text = FormatDateTime(Cells(r, 5), vbShortDate)
NextInspDue.Text = FormatDateTime(Cells(r, 6), vbShortDate)
DaysUntilDue.Text = Cells(r, 7)
DisableSave
ElseIf r = 1 Then
ClearData
Else
ClearData
MsgBox "Invalid row number"
End If
End Sub
Code block
Again, thank you for your input!
~Lucas
I have a simple spreadsheet that gathers data from a data input userform
I've created. After all the data is input I want to be able to call another
userform that will allow me to scroll through the data line by line and
display the data in labeled text boxes. I have the userform all set up and
all the boxes named appropriately but for some reason my GetData sub is not
working. Basically if the user selects row 3 I need to have all the data
pulled from row 3 and placed in the appropriate boxes on the userform for
review. Code is below, any help greatly appreciated!
Code block
Private Sub GetData()
Dim r As Long
If IsNumeric(RowNumber.Text) Then
r = (RowNumber.Text)
Else
ClearData
MsgBox "Illegal row number"
Exit Sub
End If
If r > 1 And r <= LastRow Then
EquipmentID.Text = Cells(r, 1)
Nomenclature.Text = Cells(r, 2)
InspType.Text = Cells(r, 3)
InspInt.Text = Cells(r, 4)
DateLastInsp.Text = FormatDateTime(Cells(r, 5), vbShortDate)
NextInspDue.Text = FormatDateTime(Cells(r, 6), vbShortDate)
DaysUntilDue.Text = Cells(r, 7)
DisableSave
ElseIf r = 1 Then
ClearData
Else
ClearData
MsgBox "Invalid row number"
End If
End Sub
Code block
Again, thank you for your input!
~Lucas