![]() |
VBA - hiding rows
How can I hide rows in Excel, using VBA, upon an event, like a click in a
control? THANKS! andrew |
VBA - hiding rows
I'm not sure how or what your wanting to hide but maybe this will get you
started. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Cells(1, 1) < "" Then ActiveCell.EntireRow.Hidden = True End If End Sub What the above code will do is if cell A1 is not blank then for each cell you click on it will hide the row. HTH "Andrew Appel" wrote in message ... How can I hide rows in Excel, using VBA, upon an event, like a click in a control? THANKS! andrew |
VBA - hiding rows
Thanks! This is a good start. I'm actually trying to hide a set of rows
on a sheet when I click in a control on different sheet. Is that doable? "Cliff Myers" wrote in message ... I'm not sure how or what your wanting to hide but maybe this will get you started. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Cells(1, 1) < "" Then ActiveCell.EntireRow.Hidden = True End If End Sub What the above code will do is if cell A1 is not blank then for each cell you click on it will hide the row. HTH "Andrew Appel" wrote in message ... How can I hide rows in Excel, using VBA, upon an event, like a click in a control? THANKS! andrew |
VBA - hiding rows
If you mean a button on Sheet1
you can use this Macro for example Sub test() Sheets("Sheet2").Rows("3:10").Hidden = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Andrew Appel" wrote in message ... Thanks! This is a good start. I'm actually trying to hide a set of rows on a sheet when I click in a control on different sheet. Is that doable? "Cliff Myers" wrote in message ... I'm not sure how or what your wanting to hide but maybe this will get you started. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Cells(1, 1) < "" Then ActiveCell.EntireRow.Hidden = True End If End Sub What the above code will do is if cell A1 is not blank then for each cell you click on it will hide the row. HTH "Andrew Appel" wrote in message ... How can I hide rows in Excel, using VBA, upon an event, like a click in a control? THANKS! andrew |
VBA - hiding rows
Perfect. Thanks!
andrew "Ron de Bruin" wrote in message ... If you mean a button on Sheet1 you can use this Macro for example Sub test() Sheets("Sheet2").Rows("3:10").Hidden = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Andrew Appel" wrote in message ... Thanks! This is a good start. I'm actually trying to hide a set of rows on a sheet when I click in a control on different sheet. Is that doable? "Cliff Myers" wrote in message ... I'm not sure how or what your wanting to hide but maybe this will get you started. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Cells(1, 1) < "" Then ActiveCell.EntireRow.Hidden = True End If End Sub What the above code will do is if cell A1 is not blank then for each cell you click on it will hide the row. HTH "Andrew Appel" wrote in message ... How can I hide rows in Excel, using VBA, upon an event, like a click in a control? THANKS! andrew |
VBA - hiding rows
Thanks! Perfect!
"Ron de Bruin" wrote in message ... If you mean a button on Sheet1 you can use this Macro for example Sub test() Sheets("Sheet2").Rows("3:10").Hidden = True End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Andrew Appel" wrote in message ... Thanks! This is a good start. I'm actually trying to hide a set of rows on a sheet when I click in a control on different sheet. Is that doable? "Cliff Myers" wrote in message ... I'm not sure how or what your wanting to hide but maybe this will get you started. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Cells(1, 1) < "" Then ActiveCell.EntireRow.Hidden = True End If End Sub What the above code will do is if cell A1 is not blank then for each cell you click on it will hide the row. HTH "Andrew Appel" wrote in message ... How can I hide rows in Excel, using VBA, upon an event, like a click in a control? THANKS! andrew |
All times are GMT +1. The time now is 05:37 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com