Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tvh tvh is offline
external usenet poster
 
Posts: 11
Default Option Button Code (Highlighting Rows)

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Option Button Code (Highlighting Rows)

Instead of using a formula in the Cell, I would use the OptionButton_Click()
event to both count and highlight the qualifying rows (and clear all if
OptionButton1 is selected):

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
0 Then

Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub


Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub


HTH - Glen




"tvh" wrote:

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...

  #3   Report Post  
Posted to microsoft.public.excel.programming
tvh tvh is offline
external usenet poster
 
Posts: 11
Default Option Button Code (Highlighting Rows)

Works like a charm! Thanks G!

"G-2008" wrote:

Instead of using a formula in the Cell, I would use the OptionButton_Click()
event to both count and highlight the qualifying rows (and clear all if
OptionButton1 is selected):

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
0 Then

Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub


Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub


HTH - Glen




"tvh" wrote:

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...

  #4   Report Post  
Posted to microsoft.public.excel.programming
tvh tvh is offline
external usenet poster
 
Posts: 11
Default Option Button Code (Highlighting Rows)

One more little tweek... OK, so I 'massaged' the code that G-2008 provided
and it works absolutely perfectly, except that the rows remain highlighted
even if I select another button. Selecting button one always clears the
highlights.

If I select button 2, the correct rows are highlighted; when I select button
4, I would like button 2's rows cleared and only the rows for button 4 to be
highlighted. I wish I could buy you code guys a beer!! Many thanks!!

Here's what I have so far:

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 22
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 29).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 15
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton4_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 35
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton5_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 40).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 45
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton6_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 2).Value = "Yes" And Sheet1.Cells(iRow, 18).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 50
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton7_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 30).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 24
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton8_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 31).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 12
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

"tvh" wrote:

Works like a charm! Thanks G!

"G-2008" wrote:

Instead of using a formula in the Cell, I would use the OptionButton_Click()
event to both count and highlight the qualifying rows (and clear all if
OptionButton1 is selected):

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
0 Then

Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub


Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub


HTH - Glen




"tvh" wrote:

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Option Button Code (Highlighting Rows)

Sorry about that, my oversight. Add this line

Call OptionButton1_Click

as the first line in both OptionButton2_Click() and OptionButton3_Click().
So they should both look like:

Private Sub OptionButton2_Click()
Call OptionButton1_Click
...
(remaining code)
...
End Sub

"tvh" wrote:

One more little tweek... OK, so I 'massaged' the code that G-2008 provided
and it works absolutely perfectly, except that the rows remain highlighted
even if I select another button. Selecting button one always clears the
highlights.

If I select button 2, the correct rows are highlighted; when I select button
4, I would like button 2's rows cleared and only the rows for button 4 to be
highlighted. I wish I could buy you code guys a beer!! Many thanks!!

Here's what I have so far:

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 22
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 29).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 15
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton4_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 35
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton5_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 40).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 45
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton6_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 2).Value = "Yes" And Sheet1.Cells(iRow, 18).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 50
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton7_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 30).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 24
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton8_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 31).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 12
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

"tvh" wrote:

Works like a charm! Thanks G!

"G-2008" wrote:

Instead of using a formula in the Cell, I would use the OptionButton_Click()
event to both count and highlight the qualifying rows (and clear all if
OptionButton1 is selected):

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
0 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub


Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub


HTH - Glen




"tvh" wrote:

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...



  #6   Report Post  
Posted to microsoft.public.excel.programming
tvh tvh is offline
external usenet poster
 
Posts: 11
Default Option Button Code (Highlighting Rows)

Yep...that works!!

Thanks G!

"G-2008" wrote:

Sorry about that, my oversight. Add this line

Call OptionButton1_Click

as the first line in both OptionButton2_Click() and OptionButton3_Click().
So they should both look like:

Private Sub OptionButton2_Click()
Call OptionButton1_Click
..
(remaining code)
..
End Sub

"tvh" wrote:

One more little tweek... OK, so I 'massaged' the code that G-2008 provided
and it works absolutely perfectly, except that the rows remain highlighted
even if I select another button. Selecting button one always clears the
highlights.

If I select button 2, the correct rows are highlighted; when I select button
4, I would like button 2's rows cleared and only the rows for button 4 to be
highlighted. I wish I could buy you code guys a beer!! Many thanks!!

Here's what I have so far:

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 22
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 29).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 15
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton4_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 35
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton5_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 40).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 45
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton6_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 2).Value = "Yes" And Sheet1.Cells(iRow, 18).Value
= "" Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 50
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub

Private Sub OptionButton7_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 30).Value = 1 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 24
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

Private Sub OptionButton8_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 31).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 12
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub

"tvh" wrote:

Works like a charm! Thanks G!

"G-2008" wrote:

Instead of using a formula in the Cell, I would use the OptionButton_Click()
event to both count and highlight the qualifying rows (and clear all if
OptionButton1 is selected):

Private Sub OptionButton1_Click()
Sheet1.Range("A12", "G49").Interior.ColorIndex = xlColorIndexNone
Sheet1.Cells(51, 13).Clear
End Sub


Private Sub OptionButton2_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 1).Value = "Yes" And Sheet1.Cells(iRow, 13).Value
0 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of scaffold jobs pending review: " & iCount
End Sub


Private Sub OptionButton3_Click()
Dim iCount As Integer
Dim iRow As Integer
For iRow = 12 To 49
If Sheet1.Cells(iRow, 32).Value = 2 Then
Sheet1.Range("A" & iRow, "G" & iRow).Interior.ColorIndex = 36
iCount = iCount + 1
End If
Next iRow
Sheet1.Cells(51, 13).Value = "# of items ready for scaffold removal: " &
iCount
End Sub


HTH - Glen




"tvh" wrote:

I have place 8 option buttons on my worksheet from the Control Toolbox and I
am not a VB guy at all. I've searched and played around with the code, but
it's simply not working for me. Here are my delimas:

OptionButton_1
Be the default choice each time the sheet is opened, and remain invisible.
This button is for nothing other than ensuring the other options are not
selected.

OptionButton_2
I have the following formula [="# of scaffold jobs pending review:
"&(COUNTIF(A12:A49,"Yes"))-(COUNTIF(M12:M49,"0"))], in the cell adjacent to
the button which basically returns the number of jobs pending within a
certain range. When I select OptionButton_2 I would like cells A12:G12 to be
highlighted (say light yellow) for the particular rows being counted in the
formula. So, if there are 3 scaffold jobs pending review, I would like those
three rows highlighted.

OptionButton_3
I have the following formula [="# of items ready for scaffold removal:
"&(COUNTIF(AF12:AF49,2))], in the cell adjacent to the button which counts
the cell if a value of 2 is returned. I would like the same range of cells
as above (A12:G12) highlighted light yellow for the particular rows being
counted in the formula when OptionButton_3 is selected.

The remaining buttons will have similar formulas. So, if I could see the
code structure for the above situations, I can try to figure the rest out on
my own.

Thanks for any help...

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I select an option button using code Ayo Excel Programming 2 January 6th 08 08:25 AM
How to assign same code inside Option button code space ?? furbiuzzu Excel Programming 1 November 21st 06 02:36 PM
Option button and Highlighting an area Steve Excel Worksheet Functions 2 October 17th 06 11:59 PM
Option button and Highlighting an area Steve Excel Programming 1 October 17th 06 11:53 PM
Option button and Highlighting an area Steve Excel Discussion (Misc queries) 1 October 17th 06 11:48 PM


All times are GMT +1. The time now is 09:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"