Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello I have the following Macro:
Sub Comma() Range("K3").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.Style = "Comma" End Sub How can I add maybe after Selection.Style a line into this Macro with a Conditional Formating that IF $B3 is equal to "1" then I want to have a Black cell shading and White Arial Bold font style. thanks! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Ed,
If you want to add conditionnal formatting with your macro Selection.FormatConditions.Add If you want to test Range("B3").Value and then apply format changes With Selection.Interior .ColorIndex = 1 End With With Selection.Font .Name = "Arial Narrow" .FontStyle = "Normal" .ColorIndex = 2 End With HTH Carim |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello Carim, sorry I didn't got how this code that you sent me works!
Anyways... I think I didn't explain myself well on the previous post... the idea is to have a macro which takes "$K$3" from the sheet and my idea was to drag a Conditional Formatting up to the Last Row and Column of that Table, I already have it set up to give a "Comma" format, but I would like to add the CF I mentioned before. The formula for the CF would be =$B3=1, What I mean with that is that if $B3 has "1" in it, the entire row 3 would be black and so on... but if $B4 doesn't have "1", the entire row stays as it is, and so on... This code: Range("K3").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Selection.Style = "Comma" End Sub I got it just though a simple "Record Macro", but I would like to add the CF part into it... thanks again! "Carim" wrote: Hi Ed, If you want to add conditionnal formatting with your macro Selection.FormatConditions.Add If you want to test Range("B3").Value and then apply format changes With Selection.Interior .ColorIndex = 1 End With With Selection.Font .Name = "Arial Narrow" .FontStyle = "Normal" .ColorIndex = 2 End With HTH Carim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
error when running cut & paste macro | Excel Worksheet Functions | |||
Deferring conditional formatting? | Excel Discussion (Misc queries) | |||
cannot use ISEVEN or ISODD functions in Conditional Formatting | Excel Worksheet Functions | |||
enhanced conditional formatting | Excel Discussion (Misc queries) | |||
difficulty with conditional formatting | Excel Discussion (Misc queries) |