Hi
I have code that will copy a col after finding the heading to sheet 2.
But i need to copy more than one heading to sheet 2.
so:
heading 1 is in sheet 1 A1
heading 2 is in sheet 1 B1
and so on.
In the macro i would like to nominate only the headings i want to copy to sheet 2 and they will bring the cols with them.
so could be
heading 1
heading 3
heading 5
heading 7
copied to sheet 2
Sub copycols()
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
Range("A1").Select
s1.Rows("1:1").Find(What:="heading 1", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
c = ActiveCell.Column
s1.Columns(c).Copy s2.Range("a1")
s1.Activate
End Sub
Thanks
I have code that will copy a col after finding the heading to sheet 2.
But i need to copy more than one heading to sheet 2.
so:
heading 1 is in sheet 1 A1
heading 2 is in sheet 1 B1
and so on.
In the macro i would like to nominate only the headings i want to copy to sheet 2 and they will bring the cols with them.
so could be
heading 1
heading 3
heading 5
heading 7
copied to sheet 2
Sub copycols()
Dim s1 As Worksheet, s2 As Worksheet
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
Range("A1").Select
s1.Rows("1:1").Find(What:="heading 1", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
c = ActiveCell.Column
s1.Columns(c).Copy s2.Range("a1")
s1.Activate
End Sub
Thanks