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

The following VBA code creates conditional formatting for the selecte
cell so that if a number is present in cell U2 the selected cell turn
blue:-

Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression
Formula1:="=$U2<"""""
Selection.FormatConditions(1).Interior.ColorIndex = 35

Using the same code / formatting argument how do I specify that I wan
it applied to cell A1 on sheet "Dialog11"?

Any ideas?

And

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Conditional Formatting using VBA Code

Hi
try
with worksheets("dialog11").range("A1")
..FormatConditions.Delete
..FormatConditions.Add Type:=xlExpression,
Formula1:="=$U2<"""""
..FormatConditions(1).Interior.ColorIndex = 35
end with

--
Regards
Frank Kabel
Frankfurt, Germany


The following VBA code creates conditional formatting for the

selected
cell so that if a number is present in cell U2 the selected cell

turns
blue:-

Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=$U2<"""""
Selection.FormatConditions(1).Interior.ColorIndex = 35

Using the same code / formatting argument how do I specify that I

want
it applied to cell A1 on sheet "Dialog11"?

Any ideas?

Andi


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Conditional Formatting using VBA Code

Do you want the formatting applied to A1 on Dialog11 or do you want the
formatting to check the condition of Dialog11 on sheet A1?

Also, the formula you show would react if U2 were empty, not contain a
number.
--
Regards,
Tom Ogilvy

"andibevan " wrote in message
...
The following VBA code creates conditional formatting for the selected
cell so that if a number is present in cell U2 the selected cell turns
blue:-

Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=$U2<"""""
Selection.FormatConditions(1).Interior.ColorIndex = 35

Using the same code / formatting argument how do I specify that I want
it applied to cell A1 on sheet "Dialog11"?

Any ideas?

Andi


---
Message posted from http://www.ExcelForum.com/



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
Conditional Formatting using code Ayo Excel Discussion (Misc queries) 5 February 29th 08 01:09 PM
conditional formatting w/ more than 3 conditionas, color code to a different cell oldbarnes About this forum 0 May 24th 07 01:27 AM
Override conditional formatting with code Sarah Excel Discussion (Misc queries) 4 April 30th 07 08:28 PM
Macro code to delete conditional formatting Bovine Jones Excel Discussion (Misc queries) 5 October 19th 06 08:39 AM
conditional formatting vba code and calculation Jill[_7_] Excel Programming 1 May 25th 04 12:31 AM


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