Code to Hide Rows

G

Guest

Help!

I dynamically add a worksheet during code execution in a module. I need to
also add a feature so that the user can toggle between hiding or displaying
individual rows of data. I'd thought of adding a toggle button but then
couldn't figure out how to dynamically add code to the "click" event for each
button. I then thought of creating hyperlinks to the rows but then could not
figure out how to trigger a call to a module subroutine that would hide or
display the row. Can anyone help? I'm baffled!

Example:
ROW COL1 COL2 COL3
[1] mom 1 59
[2] dad 2 61
[3] child 3 24

The user should be able to display/hide each row individually
 
D

Don Guillett

One button only
Sub togglehiderow()
ActiveCell.EntireRow.Hidden = _
Not ActiveCell.EntireRow.Hidden
End Sub
 
G

Guest

Thanks Don for responding. After reading my post, I realized I wasn't as
clear as I should have been.

I need to dynamically add a toggle button to the worksheet(s) that were
generated dynamically during code. I know that I can do this using the
AddOLEObject method. What I can't figure out is how to dynamically generate
code for the created object's "click" event so that it will hide/unhide a
specified row.



Don Guillett said:
One button only
Sub togglehiderow()
ActiveCell.EntireRow.Hidden = _
Not ActiveCell.EntireRow.Hidden
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
BHatMJ said:
Help!

I dynamically add a worksheet during code execution in a module. I need
to
also add a feature so that the user can toggle between hiding or
displaying
individual rows of data. I'd thought of adding a toggle button but then
couldn't figure out how to dynamically add code to the "click" event for
each
button. I then thought of creating hyperlinks to the rows but then could
not
figure out how to trigger a call to a module subroutine that would hide or
display the row. Can anyone help? I'm baffled!

Example:
ROW COL1 COL2 COL3
[1] mom 1 59
[2] dad 2 61
[3] child 3 24

The user should be able to display/hide each row individually
 
D

Don Guillett

How about a "Template" worksheet with a FORMS button/or shape already
there assigned to my macro in a regular module.
--
Don Guillett
SalesAid Software
(e-mail address removed)
BHatMJ said:
Thanks Don for responding. After reading my post, I realized I wasn't as
clear as I should have been.

I need to dynamically add a toggle button to the worksheet(s) that were
generated dynamically during code. I know that I can do this using the
AddOLEObject method. What I can't figure out is how to dynamically
generate
code for the created object's "click" event so that it will hide/unhide a
specified row.



Don Guillett said:
One button only
Sub togglehiderow()
ActiveCell.EntireRow.Hidden = _
Not ActiveCell.EntireRow.Hidden
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
BHatMJ said:
Help!

I dynamically add a worksheet during code execution in a module. I
need
to
also add a feature so that the user can toggle between hiding or
displaying
individual rows of data. I'd thought of adding a toggle button but
then
couldn't figure out how to dynamically add code to the "click" event
for
each
button. I then thought of creating hyperlinks to the rows but then
could
not
figure out how to trigger a call to a module subroutine that would hide
or
display the row. Can anyone help? I'm baffled!

Example:
ROW COL1 COL2 COL3
[1] mom 1 59
[2] dad 2 61
[3] child 3 24

The user should be able to display/hide each row individually
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top