I have created a userform with tabs whose names correspond with column headings. My goal is to send the form information to the next empty row of the column with the corresponding heading to that of the tab selected in the userform. My code is the following:
My dilemma:Dim nextRow As Long Dim nextRow1 As Long Dim SubName As String Dim iColumnSub As Long Dim wsB As Worksheet Set wsB = Worksheets("Banking") SubName = MultiPage2.SelectedItem.Caption iColumnSub = wsB.Range("Z1:ZZ1").Find(What:=SubName, SearchOrder:=xlColumns, SearchDirection:=xlPrevious, LookIn:=xlValues).Column nextRow = wsB.Range("Z" & Rows.Count).End(xlUp).Row + 1 wsB.Cells(nextRow, iColumnSub).Value = TextBox14.Value
Right now, only three columns are in play (though in the future there will be more). Entering data into columns 2 or 3 never poses a problem--the textbox entry falls correctly into the next empty row for the respective column. However, once data is entered into column 1, the following entry into either column 2 or 3 will not fall into the next empty row for that column--instead, a row is skipped. The result is that column 1 has a continuous list of entries and columns 2 and 3 have many skipped cells.
Finally, a new problem that has popped up is that once the data is entered, the cursor falls to a cell far from where the data was entered, leaving the user to scroll back to review the data entry into the worksheet.
Thanks for any help!
Bookmarks