Hello. This may be a simple question but, I am new to this.
I would like the caption of each visible label to show in rows of column A and the value of the textbox to go in rows of column B.
On the nextrow2 variable, I'm getting an error that say "object does not support this property or method." Please help. Thanks in advance.
I would like the caption of each visible label to show in rows of column A and the value of the textbox to go in rows of column B.
On the nextrow2 variable, I'm getting an error that say "object does not support this property or method." Please help. Thanks in advance.
Code:
[FONT=Verdana]Dim nextrow As Long[/FONT]
Dim nextrows As Long
Dim ctrl As Control
Dim ws As Worksheet
If bComplete Then
Set ws = Worksheets("Sheet2")
ws.Select
[COLOR=darkgreen]'determine the next empty row[/COLOR]
nextrow = FindLastRow(ws, "A") + 1
nextrows = FindLastRow(ws, "B") + 1
[COLOR=darkgreen]'transfer the control values[/COLOR]
For Each ctrl In Me.Controls
If ctrl.Visible Then
If TypeName(ctrl) = "TextBox" Then
ws.Cells(nextrow, 1) = ctrl.Value
nextrow = nextrow + 1
Else
If TypeName(ctrl) = "Label" Then
ws.Cells(nextrows, 2) = ctrl.Value
nextrows = nextrows + 1
End If
End If
End If
Next ctrl
Unload Me
[FONT=Verdana]End If[/FONT]