I made a userform with several textboxes, the values in these textboxes are to be filled in or to show values found in an excel sheet.
My problem is to get the Next and OK button to work. When I press Ok, it should dump all the data to the excel sheet on correct row, and with Next button it should move to next row.
The problem is that I can not simply increase a counter because it should jump to next row in the active filter, i.e next row after 45 might be 66. So how can I achieve this?
Below is my code for applying the correct filter:
Dim columnHeader As Integer
Dim ws As Worksheet
Dim Wb As Workbook
Dim lo As ListObject
Dim lsColumn As Integer
Dim counter As Integer
Dim rRange As Range, filRange As Range, Rng As Range
'set the worksheet we will be dealing with
Set Wb = ActiveWorkbook
Set ws = Wb.Sheets("List")
Call Filter.Unhide_All_Columns ' just clear all filters
'Filter our sheet
columnHeader = 2
lsColumn = HelpFunctions.getColumn("LS", ws, columnHeader, True) 'Find correct colum, i.e 18 in this case
Set lo = ws.ListObjects("FilterParts")
lo.Range.AutoFilter Field:=lsColumn, Criteria1:=""
lo.Range.Cells.ClearFormats
lo.AutoFilter.ApplyFilter
'~~> Filter, offset(to exclude headers)
Settings.filRange = lo.Range.Offset(columnHeader, 0).SpecialCells(xlCellTypeVisible).EntireRow ' Assign it to a global variable so it can be reused
I have a function called nextLine(rowNumber as long) which populates the GUI with right values.