Excel Spreadsheet:
A B C D E F
1
2
3 List_A List_B
4 Product A
5 Product B
6 Product A
7 Product C Product B
8
9 Product D Product C
10 Product E
11 Product D
12 Product E
13
14
In the above Excel spreadsheet I have list of products in Column A
and in Column C
.
Both lists contain empty cells between the values in the column.
Now, I want to identify the last non-empty row in both lists:
In Column B
this would be 10
In Column C
this would be 12
Therefore, I tried to go with this VBA
:
Sub Identify_last_Row()
Last_Row_Number_Column_B = (Sheet1.Cells(Tabelle3.Range("B3").Row, Sheet1.Range("B3").Column).End(xlDown).Row)
Last_Row_Number_Column_C = (Sheet1.Cells(Tabelle3.Range("C3").Row, Sheet1.Range("C3").Column).End(xlDown).Row)
Sheet1.Range("D1").Value = Last_Row_Number_Column_B
Sheet1.Range("E1").Value = Last_Row_Number_Column_C
End Sub
This query goes through but it does not ignore the empty cells between the values in the column.
How do I have to modify the code to identfy the last non-empty row and ignore the empty cells between the values in the column?