Baiano42
08-07-2019, 08:43 AM
Good morning Excel wizs,
I'm trying to make a Macro that will search Worksheets(1) all headers in ("1:1") for ones containing 'Top' (where one column contain "Top", others contain "Green_Top", "Red_Top", etc.), to copy the entire column (Including header reference) and paste all instances to the next blank column in Worksheets(2)
I've been trying a number of different things, but haven't had any success with it so far. Here is one of the tests that I tried without success:
Dim RowNum As Long With Worksheets(1)
Set FoundCell = .Rows(1).Find("Top", , , , xlByColumns, xlNext)
RowNum = .Cells(.Rows.count, FoundCell.Column).End(xlUp).Row - 1 '-1 for header
End With
Worksheets(2).Range("C1").Resize(RowNum).Value = FoundCell.Offset(1).Resize(RowNum).Value
I'm trying to make a Macro that will search Worksheets(1) all headers in ("1:1") for ones containing 'Top' (where one column contain "Top", others contain "Green_Top", "Red_Top", etc.), to copy the entire column (Including header reference) and paste all instances to the next blank column in Worksheets(2)
I've been trying a number of different things, but haven't had any success with it so far. Here is one of the tests that I tried without success:
Dim RowNum As Long With Worksheets(1)
Set FoundCell = .Rows(1).Find("Top", , , , xlByColumns, xlNext)
RowNum = .Cells(.Rows.count, FoundCell.Column).End(xlUp).Row - 1 '-1 for header
End With
Worksheets(2).Range("C1").Resize(RowNum).Value = FoundCell.Offset(1).Resize(RowNum).Value