Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CSK CSK is offline
external usenet poster
 
Posts: 8
Default Macro to Hide Row based on Value and then change Checkbox value

I have a macro written that cycles through every worksheet in my workbook
looking for a value of "Hide" in column D. If the criteria is meet, the row
is then hidden. This macro is working nicely. I want to take it a step
further, and in addition to hiding the row, set the form checkbox value to
False. The corresponding checkboxes are in Column B, range is B40:B52. Not
every row that meets the criteria to be hidden has a checkbox that needs to
be changed to false, but if the line does have a checkbox in column B, then I
want it turned to false.

My code looks like this:
Private Sub hiderowsif()
Dim WS As Worksheet

For Each WS In ActiveWorkbook.Worksheets
WS.Select
For Each c In Range("D3:D500")
If c.Value = "Hide" Then
c.Rows.Hidden = True
End If

Next c
Next WS

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to Hide Row based on Value and then change Checkbox value

the following code will get all the check boxes and the last line shows how
to check (or uncheck if false) the boxes.

Sub getcheckboxes()

For Each Myshape In Worksheets("Sheet2").Shapes

ShapeName = Myshape.Name

Next Myshape

Worksheets("Sheet2").CheckBoxA.Value = True
End Sub

"CSK" wrote:

I have a macro written that cycles through every worksheet in my workbook
looking for a value of "Hide" in column D. If the criteria is meet, the row
is then hidden. This macro is working nicely. I want to take it a step
further, and in addition to hiding the row, set the form checkbox value to
False. The corresponding checkboxes are in Column B, range is B40:B52. Not
every row that meets the criteria to be hidden has a checkbox that needs to
be changed to false, but if the line does have a checkbox in column B, then I
want it turned to false.

My code looks like this:
Private Sub hiderowsif()
Dim WS As Worksheet

For Each WS In ActiveWorkbook.Worksheets
WS.Select
For Each c In Range("D3:D500")
If c.Value = "Hide" Then
c.Rows.Hidden = True
End If

Next c
Next WS

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
CSK CSK is offline
external usenet poster
 
Posts: 8
Default Macro to Hide Row based on Value and then change Checkbox valu

I am not sure I was clear as to what I need. My problem is not changing all
the checkboxs to False, but that I only want to change the checkbox in column
B to false if the value on the same row in column D is "Hide". I want to
hide and change the checkbox in the same macro.

"Joel" wrote:

the following code will get all the check boxes and the last line shows how
to check (or uncheck if false) the boxes.

Sub getcheckboxes()

For Each Myshape In Worksheets("Sheet2").Shapes

ShapeName = Myshape.Name

Next Myshape

Worksheets("Sheet2").CheckBoxA.Value = True
End Sub

"CSK" wrote:

I have a macro written that cycles through every worksheet in my workbook
looking for a value of "Hide" in column D. If the criteria is meet, the row
is then hidden. This macro is working nicely. I want to take it a step
further, and in addition to hiding the row, set the form checkbox value to
False. The corresponding checkboxes are in Column B, range is B40:B52. Not
every row that meets the criteria to be hidden has a checkbox that needs to
be changed to false, but if the line does have a checkbox in column B, then I
want it turned to false.

My code looks like this:
Private Sub hiderowsif()
Dim WS As Worksheet

For Each WS In ActiveWorkbook.Worksheets
WS.Select
For Each c In Range("D3:D500")
If c.Value = "Hide" Then
c.Rows.Hidden = True
End If

Next c
Next WS

End Sub

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
Hide Columns based on checkbox values D Zandveld Excel Programming 1 March 5th 07 04:07 AM
Checkbox to Hide/Unhide Columns Based on Value in Cell BLarche[_3_] Excel Programming 3 September 14th 06 03:53 PM
PROBLEM: hide/unhide worksheets based on cell value change [email protected] Excel Programming 3 May 31st 06 02:23 PM
Applying a change based on a CheckBox Patrick Simonds Excel Programming 1 July 31st 05 10:01 PM
A Print Button macro that is based on Checkbox macros Mstr G Excel Programming 3 November 16th 04 11:55 PM


All times are GMT +1. The time now is 10:38 AM.

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"