ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying to another worksheet (https://www.excelbanter.com/excel-programming/313757-copying-another-worksheet.html)

HotRod

Copying to another worksheet
 
How can I copy columns from one worksheet to another in VBA? Also is there a
way to clear the whole sheet when I'm finished?



HotRod

Copying to another worksheet
 
I'm using the below to sort my worksheet but can only sort by three columns,
does anyone know if it's possible to sort more then three columns? I haven't
been able to figure it out yet.




Range("A" & Last_Header_Row & ":AA55550").Sort
Key1:=Range(First_Column & Last_Header_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & Last_Header_Row), _
Order2:=xlAscending, Key3:=Range(Third_Column & Last_Header_Row), _
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom



Tom Ogilvy

Copying to another worksheet
 
worksheets(1).Columns(3).copy Destination:=Worksheets("Data").Range("F1")

Worksheets("Data").Cells.ClearContents
or
Worksheets("Data").Rows.Delete

--
Regards,
Tom Ogilvy

"HotRod" wrote in message
...
How can I copy columns from one worksheet to another in VBA? Also is there

a
way to clear the whole sheet when I'm finished?





Tom Ogilvy

Copying to another worksheet
 
Excel only allows you to sort on three columns at a time. However, it uses
a persistent sort, so you can sort repeatedly from your least significant
columns to the most significant columns (3 or less at a time) and the
results will be the same as if you sorted on all those columns at once.

--
Regards,
Tom Ogilvy

"HotRod" wrote in message
...
I'm using the below to sort my worksheet but can only sort by three

columns,
does anyone know if it's possible to sort more then three columns? I

haven't
been able to figure it out yet.




Range("A" & Last_Header_Row & ":AA55550").Sort
Key1:=Range(First_Column & Last_Header_Row), _
Order1:=xlAscending, Key2:=Range(Second_Column & Last_Header_Row),

_
Order2:=xlAscending, Key3:=Range(Third_Column & Last_Header_Row),

_
Order3:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom





HotRod

Copying to another worksheet
 
THANKS



"Tom Ogilvy" wrote in message
...
worksheets(1).Columns(3).copy Destination:=Worksheets("Data").Range("F1")

Worksheets("Data").Cells.ClearContents
or
Worksheets("Data").Rows.Delete

--
Regards,
Tom Ogilvy

"HotRod" wrote in message
...
How can I copy columns from one worksheet to another in VBA? Also is
there

a
way to clear the whole sheet when I'm finished?








All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com