Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello:
I am using conditional formating in my VBA macro Code. When I run the macro I get subscript out of range. In my workbook I have the active sheet activated. Can some one point out what I may be doing wrong. Here is a snipet of my code: What I am trying to do is if BA2 has a one in it I want the pattern for cell D2 to be red. I want this to happen from D2 to n and BA2 to n. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim n As Long
n = 150 Dim Ac As String Ac = "mySheet" With ThisWorkbook.Worksheets(Ac).Range("D2").Resize(n, 1) .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, _ Formula1:="=RC53=1" .FormatConditions(1).Interior.ColorIndex = 3 End With -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pam" wrote in message ups.com... Hello: I am using conditional formating in my VBA macro Code. When I run the macro I get subscript out of range. In my workbook I have the active sheet activated. Can some one point out what I may be doing wrong. Here is a snipet of my code: What I am trying to do is if BA2 has a one in it I want the pattern for cell D2 to be red. I want this to happen from D2 to n and BA2 to n. I am thinking the xl should take care of this. Dim n As Long n = 150 Dim Ac As String Ac = "Mysheet" ThisWorkbook.Worksheets(Ac).Range("BA2").Select With ThisWorkbook.Worksheets(Ac).Range("D2").Resize(n, 1) .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, _ Formula1:="=$BA$2=1" .FormatConditions(1).Interior.ColorIndex = 3 End With I appreciate your help! Pam |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Tying Several Worksheets Together in One Worksheet | Excel Worksheet Functions | |||
Is there a shortcut command or quick access icon for subscript? | Excel Discussion (Misc queries) | |||
Subscript and Superscript: What no quick access toolbar command? | New Users to Excel | |||
Subscript out of range when adding worksheet | Excel Programming | |||
Subscript our of range when activating a worksheet | Excel Programming |