knobblywobbly
New Member
- Joined
- Sep 28, 2011
- Messages
- 4
Hi everyone,
I'm having a macro problem in Excel 2003 and wondered if you would be able to help me please? I'm copying some data from a worksheet, creating a new worksheet then pasting the data I copied into the new sheet. My code for this is below which works perfectly:
<STYLE>.alt2 font {font: 11px monospace !important;color: #333 !important;}</STYLE>
</PRE><!-- END TEMPLATE: bbcode_code -->However, the data needs quite a lot of formatting so I created a template with the required formatting and tried to use this template when creating the new worksheet. Here's the code I'm now trying to use:
<!-- BEGIN TEMPLATE: bbcode_code -->
<STYLE>.alt2 font {font: 11px monospace !important;color: #333 !important;}</STYLE>
</PRE>
<!-- END TEMPLATE: bbcode_code -->The above copies the data, creates the new worksheet based on the template file, renames the sheet to whatever is in the variable "shname", selects "A11" but then fails when trying to paste the data. I get the error message "Paste method of worksheet class failed".
Do you know why, just by changing the worksheet template, it would stop me from pasting the data into the new sheet?
Thanks
I'm having a macro problem in Excel 2003 and wondered if you would be able to help me please? I'm copying some data from a worksheet, creating a new worksheet then pasting the data I copied into the new sheet. My code for this is below which works perfectly:
<STYLE>.alt2 font {font: 11px monospace !important;color: #333 !important;}</STYLE>
Code:
Selection.Copy
Sheets.Add
ActiveSheet.Name = shname
Range("a11").Select ActiveSheet.Paste
</PRE><!-- END TEMPLATE: bbcode_code -->However, the data needs quite a lot of formatting so I created a template with the required formatting and tried to use this template when creating the new worksheet. Here's the code I'm now trying to use:
<!-- BEGIN TEMPLATE: bbcode_code -->
<STYLE>.alt2 font {font: 11px monospace !important;color: #333 !important;}</STYLE>
Code:
Selection.Copy
Sheets.Add Type:="C:\RR Files\format.xlt"
ActiveSheet.Name = shname
Range("a11").Select ActiveSheet.Paste
</PRE>
<!-- END TEMPLATE: bbcode_code -->The above copies the data, creates the new worksheet based on the template file, renames the sheet to whatever is in the variable "shname", selects "A11" but then fails when trying to paste the data. I get the error message "Paste method of worksheet class failed".
Do you know why, just by changing the worksheet template, it would stop me from pasting the data into the new sheet?
Thanks