Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Need Sample VBA Code

I have a cell (A3) with conditional formatting.

Via VBA code, I want to be able to say "Make the conditional formatting for
cells A6 through A500 the same as the conditional formatting for cell A3".
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need Sample VBA Code

Sub ABCD()
Range("A3").Copy
Range("A6:A500").PasteSpecial xlPasteFormats

End Sub

Copies all the formatting from Cell A3 including the Conditional formatting.

--
Regards,
Tom Ogilvy


"Bill Sturdevant" wrote in
message ...
I have a cell (A3) with conditional formatting.

Via VBA code, I want to be able to say "Make the conditional formatting

for
cells A6 through A500 the same as the conditional formatting for cell A3".



  #3   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Need Sample VBA Code

apply the following code to every cell you need to

Range("a3").Copy
Range("A6").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

or if the conditional formatting will always be the same

lookup formatcondition, in the help index to program the format conditions
directly
(xl2003)




"Bill Sturdevant" wrote:

I have a cell (A3) with conditional formatting.

Via VBA code, I want to be able to say "Make the conditional formatting for
cells A6 through A500 the same as the conditional formatting for cell A3".

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Need Sample VBA Code

On Wed, 26 Jan 2005 11:23:07 -0800, Bill Sturdevant
wrote:

I have a cell (A3) with conditional formatting.

Via VBA code, I want to be able to say "Make the conditional formatting for
cells A6 through A500 the same as the conditional formatting for cell A3".


Try this

Range("A3").Select
Selection.Copy
Range("A6:A500").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Hope this works as expected.

Lars-Åke
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
Sample code to be fixed! Hilton Excel Discussion (Misc queries) 0 October 1st 08 03:22 PM
code sample for executing a VB function in Excel using perl newOLE Excel Worksheet Functions 7 August 10th 05 10:26 PM
VC7.1++ Excel add-in sample code? Visual Studio 2003 Lars Schouw Excel Programming 0 February 23rd 04 11:10 AM
Blogs, sites, books, sample code, Excel+VBA+Finance Robert[_16_] Excel Programming 2 February 4th 04 12:22 PM
Debra's sample code to hide a Pivotitem Fred bon Excel Programming 0 August 7th 03 02:48 AM


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