Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to locate Cell in which control resides
Hello,
I need help getting VBA to recognize the cell in which a checkbox resides. Is there a way to know the cell position based on the location of the control. The code I am using is: With ActiveCell.Interior If CheckBox1.Value = True Then .Color = RGB(0, 255, 0) Else .Color = RGB(255, 0, 0) End If End With I basically need to change the color of the cell based on whether the control is checked or not. Thanks very much in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to locate Cell in which control resides
Hi Jamal,
Try something like: '============= Private Sub CheckBox1_Click() Dim Rng As Range Set Rng = Me.CheckBox1.TopLeftCell With Rng.Interior If Me.CheckBox1.Value = True Then .ColorIndex = 4 Else .ColorIndex = 3 End If End With End Sub '<<============= --- Regards, Norman "Jamal" wrote in message ups.com... Hello, I need help getting VBA to recognize the cell in which a checkbox resides. Is there a way to know the cell position based on the location of the control. The code I am using is: With ActiveCell.Interior If CheckBox1.Value = True Then .Color = RGB(0, 255, 0) Else .Color = RGB(255, 0, 0) End If End With I basically need to change the color of the cell based on whether the control is checked or not. Thanks very much in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Identify the row in which a MAX number in a column resides | Excel Worksheet Functions | |||
VLOOKUP when a range resides in Column A | Excel Discussion (Misc queries) | |||
Determining Row in Which Labeled Cell Resides | Excel Programming | |||
VBA - Open Folder Where .xls Resides | Excel Programming | |||
Locate max value cell | Excel Programming |