#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default Macro Question

Is there a way to repeat this macro for columns C thru Z on Sheet2 ?



Sheets("Sheet2").Select

Range("C3:C344").Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

Thank you in advance.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macro Question

simplest way if you want to do what I think you want to do is change
Range("C3:C344").Select
to
Range("C3:Z344").Select

if you need each column to go to column A individulally to do something else.

for c = 3 to 26
Sheets("Sheet2").Select

Range(cells(3,C),Cells(344,C).Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

rest of your action
next C


"carl" wrote:

Is there a way to repeat this macro for columns C thru Z on Sheet2 ?



Sheets("Sheet2").Select

Range("C3:C344").Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

Thank you in advance.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Macro Question

You could tidy this up to get rid of the "selects".

Assuming you want columns C through Z copied and pasted into column A in Sheet3

Sub foo()
For C = 3 To 26
With Sheets("Sheet2")
Range(Cells(3, C), Cells(344, C)).Copy Destination:=Sheets("Sheet3") _
.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0)
End With
Next C
End Sub


Gord Dibben MS Excel MVP

On Wed, 16 May 2007 12:41:01 -0700, bj wrote:

simplest way if you want to do what I think you want to do is change
Range("C3:C344").Select
to
Range("C3:Z344").Select

if you need each column to go to column A individulally to do something else.

for c = 3 to 26
Sheets("Sheet2").Select

Range(cells(3,C),Cells(344,C).Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

rest of your action
next C


"carl" wrote:

Is there a way to repeat this macro for columns C thru Z on Sheet2 ?



Sheets("Sheet2").Select

Range("C3:C344").Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

Thank you in advance.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Macro Question

to copy c3:z344 to the last available row from the bottom up on sheet 2. NO
selections

dlr=sheets("sheet3").cells(rows.count,"a").end(xlu p).row+1
sheets("sheet2").range(c3:z344").copy sheets("sheet3").cells(dlr,1)

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Is there a way to repeat this macro for columns C thru Z on Sheet2 ?



Sheets("Sheet2").Select

Range("C3:C344").Select

Selection.Copy

Sheets("Sheet3").Select

Range("A2").Select

Selection.End(xlDown).Select

ActiveCell.Offset(1, 0).Range("A1").Select

ActiveSheet.Paste

Thank you in advance.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Question Carl Excel Worksheet Functions 1 August 25th 06 07:40 PM
Macro Question Carl Excel Worksheet Functions 1 August 24th 06 09:03 PM
Macro Question carl Excel Worksheet Functions 0 June 8th 06 03:37 PM
Macro Question ALoecher New Users to Excel 3 March 9th 06 10:12 PM
Using a macro question. Adam Kroger Excel Discussion (Misc queries) 6 December 15th 05 09:55 PM


All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"