Hi everyone,
I'm trying to copy the range of the second table (green background), however I can only get it to copy the blue background table. I was trying to set it up so the "LastRow" was set to the row that the string "Total" is located. Which worked for my first function addSetB, which grabs the blue table if that option was selected.
I'm not able to get this working to copy over the green table and wondering how I should change my function around or how do I go about accomplishing this.
Appreciate any feedback and anyone who takes some time to try and help me out.
Here is the code I used to copy SetB (Blue Background) which functions correctly.
Here is my attempt at copying SetC (Green Background) which is not working properly at all.
I'm trying to copy the range of the second table (green background), however I can only get it to copy the blue background table. I was trying to set it up so the "LastRow" was set to the row that the string "Total" is located. Which worked for my first function addSetB, which grabs the blue table if that option was selected.
I'm not able to get this working to copy over the green table and wondering how I should change my function around or how do I go about accomplishing this.
Appreciate any feedback and anyone who takes some time to try and help me out.
Here is the code I used to copy SetB (Blue Background) which functions correctly.
VBA Code:
' ADD Data from SetB (Blue Background) to 'DATA' Sheet
Sub addSetB()
Dim LastRow As Integer
LastRow = Cells.Find(What:="Total", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("L3:Q" & LastRow).Copy
Sheets("DATA").Activate
Cells(Range("A" & rows.Count).End(xlUp).Row + 1, 1).PasteSpecial xlPasteValues
End Sub
Here is my attempt at copying SetC (Green Background) which is not working properly at all.
VBA Code:
' ADD Data from SetC (Green Background) to 'DATA' Sheet
Sub addSetC()
Dim LastRow As Integer
Dim StartRow As Integer
StartRow = Cells.Find(What:="Total", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
LastRow = Cells.Find(What:="Total", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Range("L" & StartRow & ":Q" & LastRow).Copy
Sheets("DATA").Activate
End Sub