Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Paste columnwidths in Xl2k problem

'Set 2 variables in the activesheet:

Set header_rng = ActiveSheet.Range("A1:G1")
header_rng.Copy
Set col_widths = ActiveSheet.Columns("A:J")
col_widths.Copy

'Add a new workbook, which will be active
Workbooks.Add
'followed by code which creates new sheets,
'names the sheets, and deletes the sheets (1 and
'2) created when the book was added.
'The new workbook is still the active workbook
'so:

For Each ws In ActiveWorkbook.Worksheets
With ws.Columns("A:I")
col_widths.PasteSpecial Paste:=8
End With

With ws.Range("A1")
header_rng.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End With
Next

col_widths.PasteSpecial Paste:=8 gives error:
PasteSpecial method of Range class failed

and
header_rng.PasteSpecial Paste:=xlAll
tells me that the copy/paste areas are not the same
size.

Very basic questions, I'm afraid but any help and
explanation would be much appreciated, please.

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Paste columnwidths in Xl2k problem

Try selecting just Range("A1") and let Excel fill in as the Paste happens,
rather than trying to define the range of the paste.

HTH
Ed


"Stuart" wrote in message
...
'Set 2 variables in the activesheet:

Set header_rng = ActiveSheet.Range("A1:G1")
header_rng.Copy
Set col_widths = ActiveSheet.Columns("A:J")
col_widths.Copy

'Add a new workbook, which will be active
Workbooks.Add
'followed by code which creates new sheets,
'names the sheets, and deletes the sheets (1 and
'2) created when the book was added.
'The new workbook is still the active workbook
'so:

For Each ws In ActiveWorkbook.Worksheets
With ws.Columns("A:I")
col_widths.PasteSpecial Paste:=8
End With

With ws.Range("A1")
header_rng.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End With
Next

col_widths.PasteSpecial Paste:=8 gives error:
PasteSpecial method of Range class failed

and
header_rng.PasteSpecial Paste:=xlAll
tells me that the copy/paste areas are not the same
size.

Very basic questions, I'm afraid but any help and
explanation would be much appreciated, please.

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Paste columnwidths in Xl2k problem

Thanks, but this time it was
PasteSpecial method of Range class failed
for both paste actions.

Regards.

"Ed" wrote in message
...
Try selecting just Range("A1") and let Excel fill in as the Paste happens,
rather than trying to define the range of the paste.

HTH
Ed


"Stuart" wrote in message
...
'Set 2 variables in the activesheet:

Set header_rng = ActiveSheet.Range("A1:G1")
header_rng.Copy
Set col_widths = ActiveSheet.Columns("A:J")
col_widths.Copy

'Add a new workbook, which will be active
Workbooks.Add
'followed by code which creates new sheets,
'names the sheets, and deletes the sheets (1 and
'2) created when the book was added.
'The new workbook is still the active workbook
'so:

For Each ws In ActiveWorkbook.Worksheets
With ws.Columns("A:I")
col_widths.PasteSpecial Paste:=8
End With

With ws.Range("A1")
header_rng.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End With
Next

col_widths.PasteSpecial Paste:=8 gives error:
PasteSpecial method of Range class failed

and
header_rng.PasteSpecial Paste:=xlAll
tells me that the copy/paste areas are not the same
size.

Very basic questions, I'm afraid but any help and
explanation would be much appreciated, please.

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Paste columnwidths in Xl2k problem

col_widths.copy
For Each ws In ActiveWorkbook.Worksheets
With ws.Columns("A:I")
.PasteSpecial Paste:=8
End With
Next

header_rng.copy
For Each ws In Activeworkbook.Worksheets
With ws.Range("A1")
.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End With
Next

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
Thanks, but this time it was
PasteSpecial method of Range class failed
for both paste actions.

Regards.

"Ed" wrote in message
...
Try selecting just Range("A1") and let Excel fill in as the Paste

happens,
rather than trying to define the range of the paste.

HTH
Ed


"Stuart" wrote in message
...
'Set 2 variables in the activesheet:

Set header_rng = ActiveSheet.Range("A1:G1")
header_rng.Copy
Set col_widths = ActiveSheet.Columns("A:J")
col_widths.Copy

'Add a new workbook, which will be active
Workbooks.Add
'followed by code which creates new sheets,
'names the sheets, and deletes the sheets (1 and
'2) created when the book was added.
'The new workbook is still the active workbook
'so:

For Each ws In ActiveWorkbook.Worksheets
With ws.Columns("A:I")
col_widths.PasteSpecial Paste:=8
End With

With ws.Range("A1")
header_rng.PasteSpecial Paste:=xlAll, _
Operation:=xlNone, SkipBlanks:=False, _
Transpose:=False
End With
Next

col_widths.PasteSpecial Paste:=8 gives error:
PasteSpecial method of Range class failed

and
header_rng.PasteSpecial Paste:=xlAll
tells me that the copy/paste areas are not the same
size.

Very basic questions, I'm afraid but any help and
explanation would be much appreciated, please.

Regards.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003




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
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Change Autosave defaults in XL2k RWN Setting up and Configuration of Excel 3 October 20th 05 03:16 AM
Does XL2K have hard hyphens? StargateFan Excel Discussion (Misc queries) 5 February 19th 05 07:52 PM
Copying autoshapes - XL2K Ildhund Excel Discussion (Misc queries) 2 February 17th 05 02:44 AM
Open XL2K without executing Macros Sean[_5_] Excel Programming 1 August 15th 03 01:00 PM


All times are GMT +1. The time now is 05:44 AM.

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

About Us

"It's about Microsoft Excel"