ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   automatically apply a macro to all worksheets (https://www.excelbanter.com/excel-discussion-misc-queries/73049-automatically-apply-macro-all-worksheets.html)

minrufeng

automatically apply a macro to all worksheets
 

for example, i create a simple macro for inserting a row above a certain
cell. I want the macro applied to all sheets when running the macro.
Does anyone know how to do this? thanks a lot!


--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021


Don Guillett

automatically apply a macro to all worksheets
 
try
Sub insertrowinallsheets()
myrow = ActiveCell.Row
For Each ws In Worksheets
ws.Rows(myrow).Insert
Next
End Sub


--
Don Guillett
SalesAid Software

"minrufeng" wrote
in message ...

for example, i create a simple macro for inserting a row above a certain
cell. I want the macro applied to all sheets when running the macro.
Does anyone know how to do this? thanks a lot!


--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile:
http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021




David McRitchie

automatically apply a macro to all worksheets
 
see
http://www.mvps.org/dmcritchie/excel...htm#loopsheets
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"minrufeng" wrote in message
...

for example, i create a simple macro for inserting a row above a certain
cell. I want the macro applied to all sheets when running the macro.
Does anyone know how to do this? thanks a lot!


--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021




minrufeng

automatically apply a macro to all worksheets
 

However, if I misoperate a macro to all worksheets and want to undo this
operation, what should I do? Thanks for your great help!


--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021


Dave Peterson

automatically apply a macro to all worksheets
 
Save your workbook before you run this macro.

If you screw it up, then close that workbook without saving and reopen it.

minrufeng wrote:

However, if I misoperate a macro to all worksheets and want to undo this
operation, what should I do? Thanks for your great help!

--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021


--

Dave Peterson

Don Guillett

automatically apply a macro to all worksheets
 
try.
Sub insertrowinallsheets()
myrow = ActiveCell.Row
For Each ws In Worksheets
ws.Rows(myrow).DELETE
Next
End Sub


--
Don Guillett
SalesAid Software

"minrufeng" wrote
in message ...

However, if I misoperate a macro to all worksheets and want to undo this
operation, what should I do? Thanks for your great help!


--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile:
http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515021





All times are GMT +1. The time now is 10:28 PM.

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