Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
error!
hi all, i used the code below to fill colours into my cell.. however upon running it, it gives me an error of Run-time error '91' : Object variable or With block variable not set i have another set of codes that is identical except that it uses ActiveCell.Font.ColorIndex bcos it is meant for setting the font colours of the text and it runs well.. anyone can help? thanks! the code with error: Public Sub test2() Dim cellColour As Range For Each cell In Range("B5:BA100") cellColour.Activate If ActiveCell = "PC" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "O" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "W" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "PS" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "P" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "L" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "PSC" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "LVP" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "S" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "B" Then ActiveCell.Interior.ColorIndex = 1 ElseIf ActiveCell = "A" Then ActiveCell.Interior.ColorIndex = 1 Else End If Next End Sub -- porkie ------------------------------------------------------------------------ porkie's Profile: http://www.excelforum.com/member.php...o&userid=14556 View this thread: http://www.excelforum.com/showthread...hreadid=263714 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error: "Excel encountered an error and had to remove some formatti | Excel Discussion (Misc queries) | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error | Excel Programming | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming |