Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Copy Condiltional Formatting using code

Hi,
I have a range name with few cell containing conditional formation, when I
copy that range to an other workbook using code like this, the conditional
formatting is not copied.

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets("MYSHEET").Range("A1") .Paste

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial
Paste:=xlPasteValues

I apreciate any help.
Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Copy Condiltional Formatting using code

Ben,

You need to actually paste the formatting:

Range("MYRANGE").SpecialCells(xlCellTypeVisible).C opy

'Paste Values
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial _
Paste:=xlPasteValues
'Paste FORMATS
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial _
Paste:=xlPasteFormats

HTH,
Bernie
MS Excel MVP


"Ben" wrote in message
...
Hi,
I have a range name with few cell containing conditional formation, when I
copy that range to an other workbook using code like this, the conditional
formatting is not copied.

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets("MYSHEET").Range("A1") .Paste

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial
Paste:=xlPasteValues

I apreciate any help.
Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Copy Condiltional Formatting using code

Thank you Bernie

"Bernie Deitrick" wrote:

Ben,

You need to actually paste the formatting:

Range("MYRANGE").SpecialCells(xlCellTypeVisible).C opy

'Paste Values
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial _
Paste:=xlPasteValues
'Paste FORMATS
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial _
Paste:=xlPasteFormats

HTH,
Bernie
MS Excel MVP


"Ben" wrote in message
...
Hi,
I have a range name with few cell containing conditional formation, when I
copy that range to an other workbook using code like this, the conditional
formatting is not copied.

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets("MYSHEET").Range("A1") .Paste

Range("MYRANGE").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Application.Windows(temp2).Activate
Workbooks(temp2).Worksheets(MYSHEET).Range("A1").P asteSpecial
Paste:=xlPasteValues

I apreciate any help.
Thank you




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
code does not copy Wanna Learn Excel Discussion (Misc queries) 2 July 28th 08 05:32 PM
copy and use vba code Giz New Users to Excel 6 November 24th 06 11:39 PM
copy and use vba code Giz Excel Discussion (Misc queries) 9 November 22nd 06 09:57 PM
Help with COPY code JVLin Excel Discussion (Misc queries) 0 March 6th 05 03:33 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 10:26 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"