VBA For Excel Formatting

I need VBA for eliminating Merged Fields, Wrapped Text, Borders, and Bold formatting for a Worksheet.  When I record the macro performing the tasks it creates a macro that is working with Cells, and it creates a macro that is too large for Excel.  Can anyone help me please?  Thanks.  - Tom
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Russell FoxDatabase DeveloperCommented:
Just start with Cells.Select to select the entire sheet:
Sub RemoveAllFormatting()
' RemoveAllFormatting Macro

End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomfarrarAuthor Commented:
Yes, that worked nicely.  Thanks, Russell.
Try this. Address only those formats you mentioned.

Sub ClrFrmttng()

Dim rng As Range

Set rng = Selection

With rng
    .WrapText = False
    .Font.Bold = False
    .Borders(xlDiagonalDown).LineStyle = xlNone
    .Borders(xlDiagonalUp).LineStyle = xlNone
    .Borders(xlEdgeLeft).LineStyle = xlNone
    .Borders(xlEdgeTop).LineStyle = xlNone
    .Borders(xlEdgeBottom).LineStyle = xlNone
    .Borders(xlEdgeRight).LineStyle = xlNone
    .Borders(xlInsideVertical).LineStyle = xlNone
    .Borders(xlInsideHorizontal).LineStyle = xlNone
End With

Set rng = Nothing

End Sub

Open in new window

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

tomfarrarAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for tomfarrar's comment #a41242171

for the following reason:

Thanks again, Russell.  I am trying to get a grip on the VBA.
Note that there's a Clear button on the Home tab of the ribbon that will also do what Russell mentioned.
Russell FoxDatabase DeveloperCommented:
No problem, though if it worked for you you should accept an answer as correct rather than requesting a closure.
tomfarrarAuthor Commented:
Thanks, Doug, perhaps I could have used the 'button" when recording my macro.  Sometimes I wonder about myself.  

Russell, my apology.  How do I make that change.  Didn't realize that is what I did.
Russell FoxDatabase DeveloperCommented:
That's actually exactly what I did to generate that code: start recording, select all, press clear->formats, select A1, stop recording.

I think I just need to hit the "object" button now and someone will look at it. It's just better for people who might have the same question if they can find an accepted answer here. I suggest splitting points with @Doug.
tomfarrarAuthor Commented:
Your wish is my command, Russell.  I will split the points when I get the okay to do so.  Thanks to both of you.  - Tom
tomfarrarAuthor Commented:
Thanks again, All.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.