ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Running macros automatically-AutoFit (https://www.excelbanter.com/excel-worksheet-functions/65338-running-macros-automatically-autofit.html)

Cindy B

Running macros automatically-AutoFit
 
I've used Jim Rech's autofit macro for merged cells. It works great. Thanks!

Seems I have to use alt-f8 to run the macro and make the merged cells
autofit everytime I make a change (add text). Is there a way to make it work
automatically, perhaps so that the macro is "always running"?

Anne Troy

Running macros automatically-AutoFit
 
What you want is to run the macro on a worksheet change event. To do that,
make sure the macro code is in the worksheet (Right-click the sheet and hit
View Code and paste it into the code window there, if it's not already).
Then, rename the macro so that it's called Private Sub
Worksheet_Change(ByVal Target As Range)
(or you can create a NEW macro with this name and call the other macro from
it.
I am not sure this will work perfectly for you, but will definitely give you
a place to start.
************
Hope it helps!
Anne Troy
www.OfficeArticles.com

"Cindy B" wrote in message
...
I've used Jim Rech's autofit macro for merged cells. It works great.
Thanks!

Seems I have to use alt-f8 to run the macro and make the merged cells
autofit everytime I make a change (add text). Is there a way to make it
work
automatically, perhaps so that the macro is "always running"?





All times are GMT +1. The time now is 02:20 AM.

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