I have a userform that is used to populate an excel file regarding project tasks.
I have created code linking each control to the correct column and cell number, but i would like to be more efficient in my code to speed things up. I do not want labels, and certain textbox values to be inputted and also if a contorl is blank to skip to the next.
I cant seem to order the loop through the controls correctly as it does not print in the desired cells.
It is in the incorrect order, how do i rearrange this order. Also how to i prevent it form printing false for an empty value.
lastrowST = subtaskws.range("A" & Rows.Count).End(xlUp).row Dim Ctrl As Control, col As Long, range As range col = 1 For Each Ctrl In AddTask.Controls For Each range In subtaskws.range("A" & lastrowST 1 & ":AE" & lastrowST 1 & "") If Ctrl.Name <> "TextBoxid" Then If TypeName(Ctrl) <> "Label" Then If Ctrl.Value <> "" Then range.Value = Ctrl.Value col = col 1 Else End If End If End If Next range Next Ctrl