Transferring Userform data to excel
Hi. Please help.
I am trying to use code that says for every textbox control where visible property is true, then, transfer the value in the textbox to rows in Column A of Sheet2 in Excel. Can someone please let me know where I am going wrong?
If bComplete Then
Dim nextrow As Long
Dim ctrl As Control
Sheets("sheet2").Activate
'determine the next empty row
nextrow = Application.WorksheetFunction.CountA(Range("A:A")) + 1
'transfer the control values
For Each ctrl In Me.Controls
If ctrl.Visible = True Then
If TypeName(ctrl) = "TextBox" Then
Cells(nextrow + 1, 1) = ctrl.Value
End If
End If
Next ctrl
Unload Me
End If