![]() |
Visual Basic CheckBox Codes
Hi
I am currently working on an Excel spreadsheet and I have been using the following type of coding for a number of CheckBoxes: Private Sub CheckBox174_Click() If CheckBox174.Value = True Then Rows("193").Hidden = False Rows("318").Hidden = False Else Rows("193").Hidden = True Rows("318").Hidden = True End If End Sub Am I able to name/label the rows so that I do not need to redo the coding every time I insert or delete a row into the spreadsheet? If so, how would I need to amend the above code? Cheers |
Visual Basic CheckBox Codes
Hi Su,
Yes, here is one way: Private Sub CheckBox174_Click() If CheckBox174.Value = True Then Range("First").EntireRow.Hidden = False Range("Second").EntireRow.lHidden = False Else Range("First").EntireRow.Hidden = True Range("Second").EntireRow.Hidden = True End If End Sub -- Cheers, Shane Devenshire "Su" wrote: Hi I am currently working on an Excel spreadsheet and I have been using the following type of coding for a number of CheckBoxes: Private Sub CheckBox174_Click() If CheckBox174.Value = True Then Rows("193").Hidden = False Rows("318").Hidden = False Else Rows("193").Hidden = True Rows("318").Hidden = True End If End Sub Am I able to name/label the rows so that I do not need to redo the coding every time I insert or delete a row into the spreadsheet? If so, how would I need to amend the above code? Cheers |
All times are GMT +1. The time now is 01:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com