pthomas416
New Member
- Joined
- Apr 6, 2018
- Messages
- 9
I have a workbook with several sheets that I have specified ranges for starting in A3 (same on every sheet) through column Q (row count varies). I have a sheet in the workbook that has all of the named ranges listed out in column A. I would like to write a macro that will look on sheets "Ranges" - where the list of all of the named ranges I want to copy is, go to the first named range, copy the information in A3:Q(?) and past it on a sheet named "Benefit". I have a header column, so the first pasted value start in the second row. I need it to loop through all of the named ranges listed on the sheet titled "Ranges" copying and pasting one after the other on the sheet titled "Benefit"
Anyone have any suggestions?
My Start:
{Sub ConsolData()
Dim Ranges As Range
Dim lastrowdata As Long
Dim ws As Worksheet: Set ws = Sheets("Benefit")
With Application
.Screenupdatingg = False
End With
For Each Ranges In Sheets("Ranges").Range("Ranges")
If Ranges.Value = "" Then
Exit For
Else
With Range(Ranges.Value)
lastrowdata = .Range("A:A").Find("*", [A1], , , , xlPrevious).Row
.Range("A4:Q" & lastrowdata).Copy
ws.Range("B:B").Find("*", [B1], , , , xlPrevious).Offset(1, 0).PasteSpecial xlPasteValues
End With
End If
Next Ranges
With Application
.ScreenUpdating = False
.CutCopyMode = False
End With
End Sub}
Anyone have any suggestions?
My Start:
{Sub ConsolData()
Dim Ranges As Range
Dim lastrowdata As Long
Dim ws As Worksheet: Set ws = Sheets("Benefit")
With Application
.Screenupdatingg = False
End With
For Each Ranges In Sheets("Ranges").Range("Ranges")
If Ranges.Value = "" Then
Exit For
Else
With Range(Ranges.Value)
lastrowdata = .Range("A:A").Find("*", [A1], , , , xlPrevious).Row
.Range("A4:Q" & lastrowdata).Copy
ws.Range("B:B").Find("*", [B1], , , , xlPrevious).Offset(1, 0).PasteSpecial xlPasteValues
End With
End If
Next Ranges
With Application
.ScreenUpdating = False
.CutCopyMode = False
End With
End Sub}