![]() |
Toggle for Macro
I have a worksheet that contains (50) identical estimates with one following
the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
Toggle for Macro
Option Explicit
Sub CommandButton_Click Dim ARange As Range Set ARange = Range("A1:A24") If ARange.EntireRow.Hidden = True Then ARange.EntireRow.Hidden = False ElseIf ARange.EntireRow.Hidden = False Then ARange.EntireRow.Hidden = True End If End Sub "JAD" wrote: I have a worksheet that contains (50) identical estimates with one following the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
Toggle for Macro
Or for a Toggle Button
Private Sub ToggleButton1_Click() Dim ARange As Range Set ARange = Range("A1:A24") If ToggleButton1 = False Then ARange.EntireRow.Hidden = False ToggleButton1.Caption = "Range Visible" ElseIf ToggleButton1 = True Then ARange.EntireRow.Hidden = True ToggleButton1.Caption = "Range Hidden" End If End Sub "JAD" wrote: I have a worksheet that contains (50) identical estimates with one following the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
Toggle for Macro
This code should do the same thing...
Sub CommandButton_Click() With Range("A1:A24") .EntireRow.Hidden = Not .EntireRow.Hidden End With End Sub Rick "Office_Novice" wrote in message ... Option Explicit Sub CommandButton_Click Dim ARange As Range Set ARange = Range("A1:A24") If ARange.EntireRow.Hidden = True Then ARange.EntireRow.Hidden = False ElseIf ARange.EntireRow.Hidden = False Then ARange.EntireRow.Hidden = True End If End Sub "JAD" wrote: I have a worksheet that contains (50) identical estimates with one following the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
Toggle for Macro
In the same vain as my response to your other posting in this thread, this
code should do the same thing... Private Sub ToggleButton1_Click() Range("A1:A24").EntireRow.Hidden = ToggleButton1.Value End Sub Rick "Office_Novice" wrote in message ... Or for a Toggle Button Private Sub ToggleButton1_Click() Dim ARange As Range Set ARange = Range("A1:A24") If ToggleButton1 = False Then ARange.EntireRow.Hidden = False ToggleButton1.Caption = "Range Visible" ElseIf ToggleButton1 = True Then ARange.EntireRow.Hidden = True ToggleButton1.Caption = "Range Hidden" End If End Sub "JAD" wrote: I have a worksheet that contains (50) identical estimates with one following the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
Toggle for Macro
Actually, for only two references, we can probably drop the With/EndWith
housing... Sub CommandButton_Click() Range("A1:A24").EntireRow.Hidden = Not Range("A1:A24").EntireRow.Hidden End Sub Rick "Rick Rothstein (MVP - VB)" wrote in message ... This code should do the same thing... Sub CommandButton_Click() With Range("A1:A24") .EntireRow.Hidden = Not .EntireRow.Hidden End With End Sub Rick "Office_Novice" wrote in message ... Option Explicit Sub CommandButton_Click Dim ARange As Range Set ARange = Range("A1:A24") If ARange.EntireRow.Hidden = True Then ARange.EntireRow.Hidden = False ElseIf ARange.EntireRow.Hidden = False Then ARange.EntireRow.Hidden = True End If End Sub "JAD" wrote: I have a worksheet that contains (50) identical estimates with one following the next down the spreadsheet. Each estimate is (24) rows long. AT the top of the worksheet is a single summary that shows the cost value for each of the detailed estimates below. I also use the summary to navigate to each detail estimate by hyperlinking. If I show all (50) estimates, I would have a minimum length of 50 x 24 rows or 1200 total rows long. Instead of showing all (50) estimates, I want to only show the estimates the user will be using and hide all others. Using the top summary, I was going to add a position a toggle next to each estimate summary row that when pressed will unhide the estimate the user will now enter data into. If pressed again, the estimate will go back to a hidden state. So, if TRUE the estimate is unhidden. If FALSE, the estimate is hidden. Question (finally): What would the VB statement look like to both hide and unhide a group of (24) rows per estimate? Assume the worksheet is shown initially with all (50) estimates in the hide status. Only when the toggle button is first clicked on does the particular estimate unhide. Any help would be greatly appreciated. Thank You, JAD |
All times are GMT +1. The time now is 08:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com