Locking checkbox to location when hiding/unhiding various rows

rexhvn

New Member
Joined
Jan 7, 2016
Messages
27
Hi All,

I've got a Checkbox (Active x control) which is assigned to a drop down. Each drop down hides/unhides various rows.

IE: Drop down 1 will unhide rows 10:20 and so forth.

Currently, my checkbox moves depending on what is hidden and not hidden whereas I want it to stay to row 20 for example so it only shows if this row in visible

Below is my code currently hiding it. Is there a way I can lock it so its only visible in that specific place / cell?

Sub Show_Stats()
'
' Show_Stats
'


Application.EnableEvents = False 'Stop macro from looping.
Application.ScreenUpdating = False 'Hiding the execution of the macro.


If (Range("B37").Value = "+") Then
ActiveSheet.Shapes("CheckBox1").Visible = True
Rows("40:46").Select
Selection.EntireRow.Hidden = False
Range("B37").Select
ActiveCell.FormulaR1C1 = "-"
Range("B37").Select

Else
Rows("40:46").Select
ActiveSheet.Shapes("CheckBox1").Visible = False
Selection.EntireRow.Hidden = True
Range("B37").Select
ActiveCell.FormulaR1C1 = "+"
Range("B37").Select
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
'
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top