Copying to another worksheet

  • Thread starter Thread starter HotRod
  • Start date Start date
H

HotRod

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?
 
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
 
worksheets(1).Columns(3).copy Destination:=Worksheets("Data").Range("F1")

Worksheets("Data").Cells.ClearContents
or
Worksheets("Data").Rows.Delete
 
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.
 
THANKS



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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top