ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy from worksheet to worksheet with Macro (https://www.excelbanter.com/excel-programming/276843-copy-worksheet-worksheet-macro.html)

Robert L. Altic Jr.

Copy from worksheet to worksheet with Macro
 
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming that
I am in the current month's sheet). Many thanks in advance.. Best,

Don Guillett[_4_]

Copy from worksheet to worksheet with Macro
 
Easiest way is to select the sheets you want by ctrl+sheet keytype in the
headersselect only one sheetdone

"Robert L. Altic Jr." wrote in message
...
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming that
I am in the current month's sheet). Many thanks in advance.. Best,




Tom Ogilvy

Copy from worksheet to worksheet with Macro
 
worksheets("January 22,2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")

Check the name of the January sheet - should there be a space after the
comma?

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
...
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming that
I am in the current month's sheet). Many thanks in advance.. Best,




Robert L. Altic Jr.

Copy from worksheet to worksheet with Macro
 
On Fri, 12 Sep 2003 11:39:48 -0400, "Tom Ogilvy"
wrote:

worksheets("January 22,2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")

Check the name of the January sheet - should there be a space after the
comma?

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
.. .
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming that
I am in the current month's sheet). Many thanks in advance.. Best,



Hi Tom,
Did your suggestion changing the date on the first tab and get a
subscript out of range message. Suggestions?

copy of macro:

Sub test()
'
' test Macro
' Macro recorded 6/14/2003 by Robert L. Altic Jr.
'

'
Worksheets("January 22, 2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")
End Sub


Tom Ogilvy

Copy from worksheet to worksheet with Macro
 
You get that error message if "January 22,2003". does not match the name
on the worksheet tab.

ONLY you can check that.

In otherwords, Mike doesn't answer to the name Bob. As an example.

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
...
On Fri, 12 Sep 2003 11:39:48 -0400, "Tom Ogilvy"
wrote:

worksheets("January 22,2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")

Check the name of the January sheet - should there be a space after the
comma?

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
.. .
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming that
I am in the current month's sheet). Many thanks in advance.. Best,



Hi Tom,
Did your suggestion changing the date on the first tab and get a
subscript out of range message. Suggestions?

copy of macro:

Sub test()
'
' test Macro
' Macro recorded 6/14/2003 by Robert L. Altic Jr.
'

'
Worksheets("January 22, 2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")
End Sub




Tom Ogilvy

Copy from worksheet to worksheet with Macro
 
There is no reason to have the range after the copy be a single cell - it
must be a single cell or an exact match in terms of size - it is an exact
match in the sample I provided.

--
Regards,
Tom Ogilvy

Otto Moehrbach wrote in message
...
Robert
The range after the word "Copy" should be Range("A1"). That's not the
reason for the error message. Tom is right that you should check that the
name of the January sheet is correctly written in the macro. HTH Otto
"Robert L. Altic Jr." wrote in message
...
On Fri, 12 Sep 2003 11:39:48 -0400, "Tom Ogilvy"
wrote:

worksheets("January 22,2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")

Check the name of the January sheet - should there be a space after the
comma?

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
.. .
Hi All,
I don't program macros in Excell often, but would like to automate a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to

do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming

that
I am in the current month's sheet). Many thanks in advance.. Best,


Hi Tom,
Did your suggestion changing the date on the first tab and get a
subscript out of range message. Suggestions?

copy of macro:

Sub test()
'
' test Macro
' Macro recorded 6/14/2003 by Robert L. Altic Jr.
'

'
Worksheets("January 22, 2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")
End Sub






Otto Moehrbach[_4_]

Copy from worksheet to worksheet with Macro
 
Thanks Tom. I thought it would paste the entire copy range starting with
each cell of the destination range. I learned something else from you
today. Otto
"Tom Ogilvy" wrote in message
...
There is no reason to have the range after the copy be a single cell - it
must be a single cell or an exact match in terms of size - it is an exact
match in the sample I provided.

--
Regards,
Tom Ogilvy

Otto Moehrbach wrote in message
...
Robert
The range after the word "Copy" should be Range("A1"). That's not

the
reason for the error message. Tom is right that you should check that

the
name of the January sheet is correctly written in the macro. HTH

Otto
"Robert L. Altic Jr." wrote in message
...
On Fri, 12 Sep 2003 11:39:48 -0400, "Tom Ogilvy"
wrote:

worksheets("January 22,2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")

Check the name of the January sheet - should there be a space after

the
comma?

--
Regards,
Tom Ogilvy

"Robert L. Altic Jr." wrote in message
.. .
Hi All,
I don't program macros in Excell often, but would like to automate

a
monthly spreadsheet. I would like to copy the headers from the
January worksheet to the current month and format. I can get it to

do
the formating, but what syntax is necessary to copy A!-E1 in the
January 22,2003 sheet to one for September, October etc (assuming

that
I am in the current month's sheet). Many thanks in advance.. Best,


Hi Tom,
Did your suggestion changing the date on the first tab and get a
subscript out of range message. Suggestions?

copy of macro:

Sub test()
'
' test Macro
' Macro recorded 6/14/2003 by Robert L. Altic Jr.
'

'
Worksheets("January 22, 2003").Range("A1:E1").Copy _
Destination:=ActiveSheet.Range("A1:E1")
End Sub









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

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