Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I'm having problems with this code. I've a worksheet for all levels of user.
Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Something like ....??
Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow If Cells(i, "G") < "" Then Rows(i).Hidden = True Next i End Sub Sub unhideG() Rows.Hidden = False End Sub "Chris" wrote: I'm having problems with this code. I've a worksheet for all levels of user. Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Or one macro for both jobs
Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow Rows(i).Hidden = Cells(i, "G").Value < "" Next i End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Toppers" wrote in message ... Something like ....?? Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow If Cells(i, "G") < "" Then Rows(i).Hidden = True Next i End Sub Sub unhideG() Rows.Hidden = False End Sub "Chris" wrote: I'm having problems with this code. I've a worksheet for all levels of user. Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thanks both work. Just had to assign header as it wanted to hide as well.
-- Regards "Bob Phillips" wrote: Or one macro for both jobs Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow Rows(i).Hidden = Cells(i, "G").Value < "" Next i End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Toppers" wrote in message ... Something like ....?? Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow If Cells(i, "G") < "" Then Rows(i).Hidden = True Next i End Sub Sub unhideG() Rows.Hidden = False End Sub "Chris" wrote: I'm having problems with this code. I've a worksheet for all levels of user. Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Bob,
When I run first time, rows 7 onwards are hidden as expected. when I re-run they are not unhidden as LASTROW is <7. Or I am misunderstanding something? "Bob Phillips" wrote: Or one macro for both jobs Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow Rows(i).Hidden = Cells(i, "G").Value < "" Next i End Sub -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Toppers" wrote in message ... Something like ....?? Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow If Cells(i, "G") < "" Then Rows(i).Hidden = True Next i End Sub Sub unhideG() Rows.Hidden = False End Sub "Chris" wrote: I'm having problems with this code. I've a worksheet for all levels of user. Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Toppers
Code work flawlessly, after changing last header row, as it wanted to hide as well. Thankyou for your help. -- Regards Chris "Toppers" wrote: Something like ....?? Sub HideG() lastrow = Cells(Rows.Count, "G").End(xlUp).Row For i = 7 To lastrow If Cells(i, "G") < "" Then Rows(i).Hidden = True Next i End Sub Sub unhideG() Rows.Hidden = False End Sub "Chris" wrote: I'm having problems with this code. I've a worksheet for all levels of user. Rows A1-G7 = header, Rows 8+ & Columns A-G = user data, Column G as trigger. Would like to have Sub Button1_Click() to hide rows, if date or data in G; and have a second button Sub Button2_Click() to unhide all. I'm close but no cigar. -- Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hide or unhide rows with button | Excel Discussion (Misc queries) | |||
Hide / Unhide columns and rows | Excel Discussion (Misc queries) | |||
Command Button to Hide/Unhide Rows | Excel Discussion (Misc queries) | |||
Hide Unhide Rows | Excel Discussion (Misc queries) | |||
Conditional Hide/Unhide Rows | Excel Discussion (Misc queries) |