find and replace issue in macro

B

ben

Hello,

I have a macro in Excel 2007 where I do a copy from one spreadsheet file and
special paste to another sheet in another file. This works fine and it was
created by recording a macro and then doing some minor modifications. I
wanted to then do a find and replace where I make certain rows bold and a
different color, so I recorded another macro to see what it did so I could
insert the relevant code into my original macro. I did that but the results
when using the macro change the size of the text, making it smaller. If I
then go into format cells and the text tab everything looks fine. I then
click on the font size to another size and then immediately back to the
original size it was already on and click ok and it rights itself. I am
wondering though why this has to be done to begin with - i.e. why does the
font size change?

Here's the macro:
Selection.Copy
Windows("finances_2008.xlsx").Activate
Sheets("Spending").Select

ActiveCell.Offset(0, -1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

With Application.ReplaceFormat.Font
.FontStyle = "Bold"
.Subscript = False
.ThemeColor = 4
.TintAndShade = -0.249977111
End With
Selection.Replace What:="AMEX", Replacement:="AMEX", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True

ActiveCell.Offset(0, 5).Select

Any help would be appreciated.
Thanks.
 
B

ben

I checked after running the macro and the shrintofit box was unchecked.
When I change ReplaceFormat:=True to ReplaceFormat:=False, it doesn't happen
but then I also lose the formatting.
 

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

Top