I want to create a new table from a main tabla based o columns I manage to create a code but the columns have to be always the same, I would like to create a template code that besed on the columns I select on the main tab creates a new table on a new sheet, and could be different from one time to another so I can create a quick access select my columns click the button and done new table on the new sheet
Sub CopyColumns()
Sheets(Array("Sheet1", "Sheet2")).Select
Sheets("Sheet1").Activate
Columns("A:A").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("B:B").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("C:C").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("D:D").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Sheets("Sheet1").Columns("E:E").Copy Destination:=Sheets("Sheet2").Range("E1")
Sheets("Sheet1").Select
End Sub
Sub CopyColumns()
Sheets(Array("Sheet1", "Sheet2")).Select
Sheets("Sheet1").Activate
Columns("A:A").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("B:B").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("C:C").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Columns("D:D").Select
ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll
Sheets("Sheet1").Columns("E:E").Copy Destination:=Sheets("Sheet2").Range("E1")
Sheets("Sheet1").Select
End Sub
Select columns (not the same every time ) a create a new table everytime I run the code with different selection