Excel macro

  • Thread starter Thread starter George Wilson
  • Start date Start date
G

George Wilson

I have recorded a macro that formats a cell, I am unable
to stop recording the macro with the focus on the same
cell. Hitting return I can then stop recording but get a
range statement at the end of the macro. This is what I
have for the macro:

With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "^"
Range("H27").Select

This causes the macro to end o up on the H27 cel after
every time the macro is run. Is there any way to keep the
focus on the active cell I start from?
Thanks for any assistance or suggestions...
George
 
Just edit the macro and remove the last line

With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "^"
 
just delete(erase) the last line. what is
ActiveCell.FormulaR1C1 = "^"
should be something like
ActiveCell.FormulaR1C1 = "=a1*b1"
 
I tried commenting it out and get a VBA error and it wants
to debug. Is there any way to keep from getting the error
after removing the line?
 
If you can't figure out what's going on, you may want to post the current
version of your code.

It's really easy to make a typo and when you get an extra set of eyes (or
hundreds of them), you'll usually get a response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Loop Macros 3
Change the Color of a Cell through a Macro 4
Formatting 6
Compile Error. Else without If? 6
Macro? 1
Adding formulas to rows using a Loop Macro 2
Macro Help 3
Setting borders with a macro 2

Back
Top