ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can I assign a macro to a cell? (https://www.excelbanter.com/excel-programming/331332-can-i-assign-macro-cell.html)

John McMicheal

can I assign a macro to a cell?
 
I would like to assign a macro to a cell so that when that cell is populated
the series of formattting is applied to other cells. Can I apply a macro to
a cell?

Jim Thomlinson[_4_]

can I assign a macro to a cell?
 
In a manner of speaking yes you can apply a macro to a cell. You can use the
Change event to make a macro run each time the cell is changed. To access the
change event Right Click on the Sheet tab in Excel - Choose View Code (just
above the left hand side of the code window you will see a drop down list
with the word general in it. Change it to worksheet. When you do this a
procedure will be added to the code window which is the Selection Change
event (you can delete this as you don't need it). To the right of the box you
just changed there is a drop down list. Select Change from that list. This
procedure will fire when any cell is changed. If you have some specific cells
in mind let me know and I can help you narrow down the cells...
--
HTH...

Jim Thomlinson


"John McMicheal" wrote:

I would like to assign a macro to a cell so that when that cell is populated
the series of formattting is applied to other cells. Can I apply a macro to
a cell?


JE McGimpsey

can I assign a macro to a cell?
 
Depending on what formatting you want to apply, you can do this using
conditional formatting. For instance, if you wanted to change the
background color in B1:G1 if A1 was =10, select B1:G1, choose
Format/Conditional Formatting and enter

CF1: Formula is =($A1=10)
Format1: Pattern/<color



In article ,
"John McMicheal" <John McMicheal @discussions.microsoft.com wrote:

I would like to assign a macro to a cell so that when that cell is populated
the series of formattting is applied to other cells. Can I apply a macro to
a cell?


Man Utd

can I assign a macro to a cell?
 
Yes,how do I specify which cell to be taken care of ?

"Jim Thomlinson" wrote in message
...
In a manner of speaking yes you can apply a macro to a cell. You can use
the
Change event to make a macro run each time the cell is changed. To access
the
change event Right Click on the Sheet tab in Excel - Choose View Code
(just
above the left hand side of the code window you will see a drop down list
with the word general in it. Change it to worksheet. When you do this a
procedure will be added to the code window which is the Selection Change
event (you can delete this as you don't need it). To the right of the box
you
just changed there is a drop down list. Select Change from that list. This
procedure will fire when any cell is changed. If you have some specific
cells
in mind let me know and I can help you narrow down the cells...
--
HTH...

Jim Thomlinson


"John McMicheal" wrote:

I would like to assign a macro to a cell so that when that cell is
populated
the series of formattting is applied to other cells. Can I apply a macro
to
a cell?





All times are GMT +1. The time now is 09:29 PM.

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