Originally Posted by
JKwan
Thanks, Sam.
i like it too
If I want to add the caption of each visible label to the worksheet, as well, how would I go about that?
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.
I added another variable but, I'm getting an error that say "object does not support this property or method." Please help. Thanks in advance.
Dim nextrow As Long
Dim nextrows As Long
Dim ctrl As Control
Dim ws As Worksheet
If bComplete Then
Set ws = Worksheets("Sheet2")
ws.Select
'determine the next empty row
nextrow = FindLastRow(ws, "A") + 1
nextrows = FindLastRow(ws, "B") + 1
'transfer the control values
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
End If