Rowland Hamilton
Active Member
- Joined
- Nov 13, 2009
- Messages
- 250
Folks:
Looking to modify your code to find the row with "Grand Total" in column B, then
I tried this code, it only copied 2 rows, definitely not the row with "Grand Total" found in it.
How can I fix it?
Thank you, Rowland:
Looking to modify your code to find the row with "Grand Total" in column B, then
Code:
Range("A2:H" & LstRow).Copy
I tried this code, it only copied 2 rows, definitely not the row with "Grand Total" found in it.
How can I fix it?
Thank you, Rowland:
Code:
Sub try_this()
'copy
Workbooks("United States (de linked)xxxx.xlsm").Activate
Sheets("500-Sample").Activate
'Expand Column groups, Collapse Row groups
ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=2
'contiguous method won't work:
'Range("A3").Select
'Range(Selection, Selection.End(xlDown)).Select
'Range(Selection, Selection.End(xlToRight)).Select
LstRow = Application.WorksheetFunction.Match("Grand Total", ActiveSheet.Range("B:B"))
Range("A2:H" & LstRow).Copy
'paste
Workbooks("Incoming_Data.xlsm").Activate
Sheets("Master-Incoming").Activate
Range("B65000").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, -1).Select
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Workbooks("United States (de linked)xxxx.xlsm").Activate
'These two maybe not necessary bc don't save this wb:
Application.CutCopyMode = False
Range("B1").Select
End Sub