#1   Report Post  
Posted to microsoft.public.excel.misc
Matt
 
Posts: n/a
Default hide/unhide macro

right now i am using the group and ungroup from the data menu to hide
particular rows. i need help (i fairly new to this) creating a macro that
when either a toggle button, or command button is pressed will hide/unhide
the row above it. for instance rows 4&5 are grouped, but row four is
hidden... how can i create a button to put on row 5 to hide/unhide row 4? i
don't like grouping the rows because when i protect the sheet you cannot
group or ungroup the rows...
  #2   Report Post  
Posted to microsoft.public.excel.misc
JR
 
Posts: n/a
Default hide/unhide macro

The easiest way to do this is to record one macro to hide and another to
unhide ("Tools", "Macro", "Record New Macro"). Then assign the macros to
buttons, or drawing objects by right clicking on them and selecting "Assign
Macro".

"Matt" wrote:

right now i am using the group and ungroup from the data menu to hide
particular rows. i need help (i fairly new to this) creating a macro that
when either a toggle button, or command button is pressed will hide/unhide
the row above it. for instance rows 4&5 are grouped, but row four is
hidden... how can i create a button to put on row 5 to hide/unhide row 4? i
don't like grouping the rows because when i protect the sheet you cannot
group or ungroup the rows...

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default hide/unhide macro

The code that follows will unhide the row immediately above the active
cell. You can attach that to a button and place the button on row 5-
but will you need it in other places as well? Having a button for
every row that *might* be hidden would be chunky and ugly and tedious.
As an alternative you might freeze the sprdsht panes in such a way that
the upper left corner is always visible, and place the button there.

FYI This code contains a command that lands the cell pointer on column
A of the unhidden row- you can change or delete that as you like.

Sub Unhide_Row_Above()
Dim Roe As Long

Roe = ActiveCell.Offset(-1, 0).Row
Rows(Roe & ":" & Roe).Select
Selection.EntireRow.Hidden = False
Range("a" & Roe).Select
End Sub

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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 01:46 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"