Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Through a command button hiding rows


Help!
I am creating a workbook where in worksheet1 there is a checklist
Ideally when a topic's checkbox is clicked, a macro (which I hav
assigned) will hide certain rows on worksheet2.
However I cannot get the action to reverse when the box is unchecked.
This is really frustrating me as I have tried to write a program usin
boolean instead of the macro for when the button is "clicked" and the
clicked again, but I am not getting anywhere.

If it helps the rows I have also grouped into arrays.

Below is like my 20th attempt

Private Sub CheckBox1_Click()
Sheets("Sheet1").Select
i = Rows("13:22")
i.Select
Selection.EntireRow.Hidden = True
Sheets("Sheet2").Select

End Sub;

--
Sa
-----------------------------------------------------------------------
Saz's Profile: http://www.excelforum.com/member.php...fo&userid=1722
View this thread: http://www.excelforum.com/showthread.php?threadid=54946

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Through a command button hiding rows

If you want them hidden when the checkbox is checked and unhidden when it is
unchecked then

Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = CheckBox1.Value
End Sub

for the opposite:


Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = Not CheckBox1.Value
End Sub

--
Regards,
Tom Ogilvy





"Saz" wrote:


Help!
I am creating a workbook where in worksheet1 there is a checklist.
Ideally when a topic's checkbox is clicked, a macro (which I have
assigned) will hide certain rows on worksheet2.
However I cannot get the action to reverse when the box is unchecked.
This is really frustrating me as I have tried to write a program using
boolean instead of the macro for when the button is "clicked" and then
clicked again, but I am not getting anywhere.

If it helps the rows I have also grouped into arrays.

Below is like my 20th attempt

Private Sub CheckBox1_Click()
Sheets("Sheet1").Select
i = Rows("13:22")
i.Select
Selection.EntireRow.Hidden = True
Sheets("Sheet2").Select

End Sub;)


--
Saz
------------------------------------------------------------------------
Saz's Profile: http://www.excelforum.com/member.php...o&userid=17226
View this thread: http://www.excelforum.com/showthread...hreadid=549468


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Through a command button hiding rows


Tom I have tried yours but it will not allow both together as an erro
occurs stating ambigious error detected as CheckBox1_Click is alread
being used. I want to use both of your programs that you have create
for the checkbox. Do you know how?

Thanks;)

Tom Ogilvy Wrote:
If you want them hidden when the checkbox is checked and unhidden whe
it is
unchecked then

Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = CheckBox1.Value
End Sub

for the opposite:


Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = Not CheckBox1.Value
End Sub

--
Regards,
Tom Ogilvy





"Saz" wrote:


Help!
I am creating a workbook where in worksheet1 there is a checklist.
Ideally when a topic's checkbox is clicked, a macro (which I have
assigned) will hide certain rows on worksheet2.
However I cannot get the action to reverse when the box i

unchecked.
This is really frustrating me as I have tried to write a progra

using
boolean instead of the macro for when the button is "clicked" an

then
clicked again, but I am not getting anywhere.

If it helps the rows I have also grouped into arrays.

Below is like my 20th attempt

Private Sub CheckBox1_Click()
Sheets("Sheet1").Select
i = Rows("13:22")
i.Select
Selection.EntireRow.Hidden = True
Sheets("Sheet2").Select

End Sub;)


--
Saz


------------------------------------------------------------------------
Saz's Profile

http://www.excelforum.com/member.php...o&userid=17226
View this thread

http://www.excelforum.com/showthread...hreadid=549468



--
Sa
-----------------------------------------------------------------------
Saz's Profile: http://www.excelforum.com/member.php...fo&userid=1722
View this thread: http://www.excelforum.com/showthread.php?threadid=54946



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Through a command button hiding rows

I don't think you understand the code. Either want them hidden when it is
checked or you want them unhidden when it is checked. Both codes will handle
both checking and unchecking. The first hides them when it is checked and
unhides them when it is unchecked - both actions trigger the click event.
The second does the opposite - so you only need one.

--
Regards,
Tom Ogilvy


"Saz" wrote:


Tom I have tried yours but it will not allow both together as an error
occurs stating ambigious error detected as CheckBox1_Click is already
being used. I want to use both of your programs that you have created
for the checkbox. Do you know how?

Thanks;)

Tom Ogilvy Wrote:
If you want them hidden when the checkbox is checked and unhidden when
it is
unchecked then

Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = CheckBox1.Value
End Sub

for the opposite:


Private Sub CheckBox1_Click()
Set rng = Sheets("Sheet1").Rows("13:22")
rng.Hidden = Not CheckBox1.Value
End Sub

--
Regards,
Tom Ogilvy





"Saz" wrote:


Help!
I am creating a workbook where in worksheet1 there is a checklist.
Ideally when a topic's checkbox is clicked, a macro (which I have
assigned) will hide certain rows on worksheet2.
However I cannot get the action to reverse when the box is

unchecked.
This is really frustrating me as I have tried to write a program

using
boolean instead of the macro for when the button is "clicked" and

then
clicked again, but I am not getting anywhere.

If it helps the rows I have also grouped into arrays.

Below is like my 20th attempt

Private Sub CheckBox1_Click()
Sheets("Sheet1").Select
i = Rows("13:22")
i.Select
Selection.EntireRow.Hidden = True
Sheets("Sheet2").Select

End Sub;)


--
Saz

------------------------------------------------------------------------
Saz's Profile:

http://www.excelforum.com/member.php...o&userid=17226
View this thread:

http://www.excelforum.com/showthread...hreadid=549468




--
Saz
------------------------------------------------------------------------
Saz's Profile: http://www.excelforum.com/member.php...o&userid=17226
View this thread: http://www.excelforum.com/showthread...hreadid=549468


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Through a command button hiding rows


I used yours and at first tried to use both programs you provided at the
same time, but found that the first one on its own worked perfectly!

Cheers Honey!


--
Saz
------------------------------------------------------------------------
Saz's Profile: http://www.excelforum.com/member.php...o&userid=17226
View this thread: http://www.excelforum.com/showthread...hreadid=549468

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collapsing rows via command button Stephanie Excel Discussion (Misc queries) 2 August 11th 09 05:45 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Command Button to Hide/Unhide Rows Bea Excel Discussion (Misc queries) 4 March 16th 06 03:21 PM
Inserting rows from a command button jontait[_11_] Excel Programming 3 May 19th 04 02:16 PM
Hiding A Sheet Command Button With VBA Minitman[_3_] Excel Programming 2 March 7th 04 01:16 AM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"