ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro help needed (https://www.excelbanter.com/excel-worksheet-functions/177522-macro-help-needed.html)

James

Macro help needed
 
I am looking to set up a macro to unhide a new row every time a button is
clicked.

I have set up a macro that opens up a new row, but it doesn't add any rows
after that.

Private Sub CommandButton1_Click()
'
' Add_New_Project Macro
' Macro recorded 22/02/2008 by
'
'
ActiveWindow.SmallScroll Down:=5
ActiveSheet.Shapes("CommandButton1").Select
ActiveWindow.SmallScroll Down:=-75
Rows("2:99").Select
Range("A99").Activate
Selection.EntireRow.Hidden = False
Rows("3:97").Select
Range("A97").Activate
Selection.EntireRow.Hidden = True
End Sub

Could anyone help with this?
--
J

Don Guillett

Macro help needed
 
Guessing here but if you want to unhide the last row and hide 2 rows above

sub unhide row()
lr=cells(rows.count,"a").end(xlup).row
rows(lr).hidden=false
rows(lr-2).hidden=true
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"James" wrote in message
...
I am looking to set up a macro to unhide a new row every time a button is
clicked.

I have set up a macro that opens up a new row, but it doesn't add any rows
after that.

Private Sub CommandButton1_Click()
'
' Add_New_Project Macro
' Macro recorded 22/02/2008 by
'
'
ActiveWindow.SmallScroll Down:=5
ActiveSheet.Shapes("CommandButton1").Select
ActiveWindow.SmallScroll Down:=-75
Rows("2:99").Select
Range("A99").Activate
Selection.EntireRow.Hidden = False
Rows("3:97").Select
Range("A97").Activate
Selection.EntireRow.Hidden = True
End Sub

Could anyone help with this?
--
J




All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com