Hello, I am trying to loop through textboxes from 1 through 24 in my userform, and print the text (if text exist) in column a. However, only the last textbox with a value is printed. Any advice?
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Dim rng As Range
Set rng = ws.Range("A" & lr + 1)
Dim i As Integer
For i = 1 To 24
If Controls("txtColA" & i).Value <> "" Then
rng = Controls("txtColA" & i).Value
End If
Next i
Dim lr As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
Dim rng As Range
Set rng = ws.Range("A" & lr + 1)
Dim i As Integer
For i = 1 To 24
If Controls("txtColA" & i).Value <> "" Then
rng = Controls("txtColA" & i).Value
End If
Next i