ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   EXCEL Checkboxxx Props. (https://www.excelbanter.com/excel-programming/307464-excel-checkboxxx-props.html)

djayc53

EXCEL Checkboxxx Props.
 
I was hoping to create a spreadsheet in which i could have a workboo
appear/dissapear based on the status (checked/uncheckd) of a checkbox
have planted in the main workbook. I am familiar with VB, but not wit
excel macros and would very much appreciate the help. This is what
was thinking..

Sub CheckBox1_Click()
If Sheet1.Index(A1:J40, 2, 4) = "TRUE" Then
Sheet2.Visible = xlSheetVisible
Else
End If
If Sheet1.Index(A1:J40, 2, 4) = "FALSE" Then
Sheet2.Visible = xlSheetHidden
End If
End Sub

The cell referenced in the previous code (2, 4) is the cell that I hav
associated with the checkox. It's text is either TRUE or FALSE dependin
on the state of the box. I might be totally on the wrong track wit
this..

Please help. Thanks!

D

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

EXCEL Checkboxxx Props.
 
Maybe you could just use if the checkbox is checked or not:

Option Explicit
Private Sub CheckBox1_Click()
Sheet2.Visible = Not (Me.CheckBox1.Value)
End Sub

Or something like this:
Option Explicit
Private Sub CheckBox1_Click()
Sheet2.Visible = Not (Range(Me.CheckBox1.LinkedCell).Value)
End Sub

Or if you know the cell's location on the same sheet.

Option Explicit
Private Sub CheckBox1_Click()
Sheet2.Visible = Not (me.cells(2,4).Value)
End Sub

I like the first.


"djayc53 <" wrote:

I was hoping to create a spreadsheet in which i could have a workbook
appear/dissapear based on the status (checked/uncheckd) of a checkbox i
have planted in the main workbook. I am familiar with VB, but not with
excel macros and would very much appreciate the help. This is what I
was thinking..

Sub CheckBox1_Click()
If Sheet1.Index(A1:J40, 2, 4) = "TRUE" Then
Sheet2.Visible = xlSheetVisible
Else
End If
If Sheet1.Index(A1:J40, 2, 4) = "FALSE" Then
Sheet2.Visible = xlSheetHidden
End If
End Sub

The cell referenced in the previous code (2, 4) is the cell that I have
associated with the checkox. It's text is either TRUE or FALSE depending
on the state of the box. I might be totally on the wrong track with
this..

Please help. Thanks!

DC

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 10:56 PM.

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