Forum Discussion
PerMorris
Jul 08, 2019Copper Contributor
SOLVED! Find certain table within data sheet and the find last row in that table
Hi, I have a problem that I can't find the solution to. I have (as you can see in the picture bellow a data sheet with different tables. Each table is divided by 2 empty rows as you can see. There ar...
Berndvbatanker
Jul 08, 2019Iron Contributor
Hi,
i write an userdefined function to do the job. See attached file.
Function GetLast(strKEy As String) As Double
Dim rngFind As Range
Dim lngLastRow As Long
Set rngFind = ActiveSheet.Range("B:B").Find(what:=strKEy, lookat:=xlWhole)
If Not rngFind Is Nothing Then
lngLastRow = Cells(rngFind.Row, "B").End(xlDown).Row
GetLast = Cells(lngLastRow, "E").Value
Else
GetLast = 0
End If
End Function
Best regards
Bernd
https://vba-tanker.com/
PerMorris
Jul 09, 2019Copper Contributor
Big thanks Bernd, worked brilliantly!