Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ksh ksh is offline
external usenet poster
 
Posts: 16
Default copy cell format

Hello -
I recorded a macro to copy the format of a range of cells on sheet2 to an
equal range of cells on sheet 1. When I run the macro it copies the data
from sheet 2, but then it runs into a problem on the
"Range("D34:D49").Select" step and gives me the following error.

select method of range class failed

Sheets("Sheet2").Select
Range("D9:D24").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D34:D49").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Thanks for any info you can give me on this.
  #2   Report Post  
Posted to microsoft.public.excel.programming
ksh ksh is offline
external usenet poster
 
Posts: 16
Default copy cell format

I found the problem. I had the code attached to a command button in sheet 2.
I moved the macro to module in the workbook and it works fine now.

"ksh" wrote:

Hello -
I recorded a macro to copy the format of a range of cells on sheet2 to an
equal range of cells on sheet 1. When I run the macro it copies the data
from sheet 2, but then it runs into a problem on the
"Range("D34:D49").Select" step and gives me the following error.

select method of range class failed

Sheets("Sheet2").Select
Range("D9:D24").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D34:D49").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Thanks for any info you can give me on this.

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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
Copy worksheet1 to worksheet2, keep cell format eg cell size slocookie Excel Discussion (Misc queries) 2 January 8th 10 11:24 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Copy partial cell character format(s) from one cell to another - an example [email protected] Excel Programming 0 May 5th 05 08:23 PM


All times are GMT +1. The time now is 02:05 PM.

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"