ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   help with debug (https://www.excelbanter.com/new-users-excel/10912-help-debug.html)

Rusty

help with debug
 
Sub CheckBox3_Click()
'
' CheckBox3_Click Macro
' Macro recorded 2/1/2005 by Geo. Z'
' Keyboard Shortcut: Ctrl+z
'
ActiveCell.Offset(-13, 2).Range("A1").Select
Selection.Font.ColorIndex = 3
End Sub


What I'm trying to do is when the box is checked in "A" the text in "J" is red, Unchecked = black, down the hole sheet.
I think the "Active cell" line is where to start?
thanks for any help..

JulieD

Hi Rusty

From my understanding of your question you have one check box in A1 and when it is checked you what the whole of column J to go red, if so, right mouse click on the check box and choose view code and then copy & paste the following into the procedure that is created it should give you what you want:

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
ActiveSheet.Columns(10).Font.ColorIndex = 3
Else
ActiveSheet.Columns(10).Font.ColorIndex = 1
End If

End Sub

---
If i've misunderstood the question please let us know.

Cheers
JulieD

"Rusty" wrote in message ...
Sub CheckBox3_Click()
'
' CheckBox3_Click Macro
' Macro recorded 2/1/2005 by Geo. Z'
' Keyboard Shortcut: Ctrl+z
'
ActiveCell.Offset(-13, 2).Range("A1").Select
Selection.Font.ColorIndex = 3
End Sub


What I'm trying to do is when the box is checked in "A" the text in "J" is red, Unchecked = black, down the hole sheet.
I think the "Active cell" line is where to start?
thanks for any help..

Rusty

Sorry I wasn't clear
I have a check box in each row in "A" when it is checked I want "J" in that row red.
Thank You for the reply
"JulieD" wrote in message ...
Hi Rusty

From my understanding of your question you have one check box in A1 and when it is checked you what the whole of column J to go red, if so, right mouse click on the check box and choose view code and then copy & paste the following into the procedure that is created it should give you what you want:

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
ActiveSheet.Columns(10).Font.ColorIndex = 3
Else
ActiveSheet.Columns(10).Font.ColorIndex = 1
End If

End Sub

---
If i've misunderstood the question please let us know.

Cheers
JulieD

"Rusty" wrote in message ...
Sub CheckBox3_Click()
'
' CheckBox3_Click Macro
' Macro recorded 2/1/2005 by Geo. Z'
' Keyboard Shortcut: Ctrl+z
'
ActiveCell.Offset(-13, 2).Range("A1").Select
Selection.Font.ColorIndex = 3
End Sub


What I'm trying to do is when the box is checked in "A" the text in "J" is red, Unchecked = black, down the hole sheet.
I think the "Active cell" line is where to start?
thanks for any help..

Dave Peterson

If you used checkboxes from the Control toolbox toolbar, you'll need code like
this:

Option Explicit
Private Sub CheckBox1_Click()

With Me.CheckBox1
If .Value = True Then
.TopLeftCell.Offset(0, 9).Interior.ColorIndex = 3
Else
.TopLeftCell.Offset(0, 9).Interior.ColorIndex = xlNone
End If
End With

End Sub

If you replaced those checkboxes with a checkbox from the Forms toolbar, you
could have one macro assigned to all of the checkboxes.

Option Explicit
Sub testme()

Dim myCBX As CheckBox
Set myCBX = ActiveSheet.CheckBoxes(Application.Caller)

With myCBX
If .Value = xlOn Then
.TopLeftCell.Offset(0, 9).Interior.ColorIndex = 3
Else
.TopLeftCell.Offset(0, 9).Interior.ColorIndex = xlNone
End If
End With

End Sub

Another option would be to use a linkedcell and then use format|conditional
formatting to check that linkedcell's value.

Rusty wrote:

Sub CheckBox3_Click()
'
' CheckBox3_Click Macro
' Macro recorded 2/1/2005 by Geo. Z'
' Keyboard Shortcut: Ctrl+z
'
ActiveCell.Offset(-13, 2).Range("A1").Select
Selection.Font.ColorIndex = 3
End Sub


What I'm trying to do is when the box is checked in "A" the text in "J" is
red, Unchecked = black, down the hole sheet.
I think the "Active cell" line is where to start?
thanks for any help..


--

Dave Peterson


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com