How to make a macro do an action or actions in the active cell

  • Thread starter Thread starter nun
  • Start date Start date
N

nun

I have tried to make some macros but what I want it to do is an action or
series of action to the active cell I am in or selected. When I recorded the
macro, it recorded the cell I did the action and would repeat
there.........is there a way to make it do what I want in the cell I am
currently in?

Thanks Paul
 
Hi Paul,
...series of action to the active cell I am in or selected.<

ActiveCell.Value = "Try this"
ActiveCell.Font.Bold = True
ActiveCell.Resize(2, 2).Select
ActiveCell.Offset(5, 5).Value = "It works"

A few examples.

HTH
Regards,
Howard
 
Thanks for the response. I hope I understand this correctly..... so if I
record a macro and do a series of action to a certain cell. Let's say it is
B10, and I make it bold, change the font color and size. The macro will look
something like.....

select B10
make bold (I do not remember how this is all phrased)
change font color
change font size to 14

Then when I go to run this macro it will go to cell B10 and do these
actions. I need to replace "B10" with active cell?...or what?

Thanks Paul

myemails @ mchsi.com
 
You need to make the change one time. ActiveCell always refers to the
cell that is 'active', i.e., where data entry would occur if you
started typing.

For more on moving beyond the macro recorder, see the Excel | VBA |
'Beyond Excel's recorder' page of my web site.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Back
Top