0

I Have some sheets and a "Consolidated Pipeline" sheet in which i have to merge all the other sheets. I just need to copy all the data from every sheet in the consolidated one, one after the other.

I have a problem with the function that find the last non-empty row to understand where to append the data in the consolidated sheet but it seems that the last row returned is always the very last row of the document, not the last non-empty one

this is the function

Function LastRow(sh As Worksheet)
    On Error Resume Next
    LastRow = sh.Cells.Find(what:="*", _
                            After:=sh.Range("A1"), _
                            Lookat:=xlPart, _
                            LookIn:=xlFormulas, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlPrevious, _
                            MatchCase:=False).Row                          
    On Error GoTo 0
End Function
Syertim
  • 147
  • 1
  • 12

0 Answers0