PC Review


Reply
Thread Tools Rate Thread

Control Toolbox and Private Sub Worksheet_Change(ByVal Target As R

 
 
=?Utf-8?B?UXVsbDY2NkBob3RtYWlsLmNvbQ==?=
Guest
Posts: n/a
 
      17th Aug 2007
Control Toolbox and Private Sub Worksheet_Change(ByVal Target As Range)
-------------------------------------------------------------------------

Dear Everyone,

I really appreciate all help I can get.

Here goes:

1) I have a toggle button when its switched on, cell J2 shows TRUE. If it is
switched off then FALSE.

2) In cell A1, i have this formula: =IF(J2=TRUE,1,2)


3) I have this macro (which does not work with the toggle button).

'By Ron de Bruin
'If you enter 1 in A1 it hide sheet2 and sheet3
'If A1 = 2 it unhide them

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh As Worksheet
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
For Each sh In Sheets(Array("Sheet2", "Sheet3"))
If Target.Value = 1 Then sh.Visible = xlSheetHidden
If Target.Value = 2 Then sh.Visible = xlSheetVisible
Next sh
End If
End Sub


Summary:
A1 = Determines hide or unhide (macro)
J2 = LinkedCell from toggle button

Note: If I enter value 1 or 2 in cell A1, the macro will work. But I wanna
use a toggle button or stuff from the control toolbox.



How can I get it to work.
Thanks.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UXVsbDY2NkBob3RtYWlsLmNvbQ==?=
Guest
Posts: n/a
 
      17th Aug 2007
Dear Toppers, thanks for the codes.

I messed with one of the codes, and IT WORKED!!!...

I will mess with the second code during the weekend!!! Thanks!!!.

Now I understand about change event (data entry only).

Much appreciated!!!


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Control Toolbox and Private Sub Worksheet_Change(ByVal Target As R =?Utf-8?B?VG9wcGVycw==?= Microsoft Excel Misc 0 17th Aug 2007 02:02 AM
RE: Control Toolbox and Private Sub Worksheet_Change(ByVal Target =?Utf-8?B?VG9wcGVycw==?= Microsoft Excel Misc 0 17th Aug 2007 01:52 AM
Private Sub Worksheet_Change(ByVal Target As Range) =?Utf-8?B?UGFpZ2U=?= Microsoft Excel Programming 1 17th May 2007 12:16 AM
Private Sub Worksheet_Change(ByVal Target As Range) =?Utf-8?B?cGQxMjM0MzIx?= Microsoft Excel Programming 5 8th Dec 2006 04:11 AM
Private Sub Worksheet_Change(ByVal Target As Range) =?Utf-8?B?QXJ0dXJv?= Microsoft Excel Programming 1 25th May 2005 03:32 PM


Features
 

Advertising
 

Newsgroups
 


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