ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding/Unhiding Rows in a worksheet based on the value of a checkbox. (https://www.excelbanter.com/excel-programming/414935-hiding-unhiding-rows-worksheet-based-value-checkbox.html)

R Tanner

Hiding/Unhiding Rows in a worksheet based on the value of a checkbox.
 
Hi,

I am using the following code to try and hide/unhide a row in a
worksheet. It hides the row just fine, but it won't unhide it. What
am I doing wrong??

If ActiveSheet.OLEObjects(1).Object.Value = True Then
ActiveSheet.Range("EURUSD").EntireRow.Hidden = False
Else
ActiveSheet.Range("EURUSD").EntireRow.Hidden = True
End If

I tried this code before and it didn't work either.

sheets("Data Layout").Range("EURUSD").EntireRow.Hidden= _
Not sheets("Data Layout").OleObjects(1).object.value

Much simpler, I only wish I could get it to work...Any ideas?

Thanks


StumpedAgain

Hiding/Unhiding Rows in a worksheet based on the value of a checkb
 
I would recommend event programming like the following:

Private Sub CheckBox1_Click()

If ActiveSheet.CheckBox1.Value = True Then
ActiveSheet.Range("EURUSD").EntireRow.Hidden = False
Else
ActiveSheet.Range("EURUSD").EntireRow.Hidden = True
End If

End Sub

--
-SA


"R Tanner" wrote:

Hi,

I am using the following code to try and hide/unhide a row in a
worksheet. It hides the row just fine, but it won't unhide it. What
am I doing wrong??

If ActiveSheet.OLEObjects(1).Object.Value = True Then
ActiveSheet.Range("EURUSD").EntireRow.Hidden = False
Else
ActiveSheet.Range("EURUSD").EntireRow.Hidden = True
End If

I tried this code before and it didn't work either.

sheets("Data Layout").Range("EURUSD").EntireRow.Hidden= _
Not sheets("Data Layout").OleObjects(1).object.value

Much simpler, I only wish I could get it to work...Any ideas?

Thanks




All times are GMT +1. The time now is 12:22 AM.

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