VBA Routine to alter Spreadsheet Cell Formats

A while ago I needed a routine to alter the cell formatting of a client spreadsheet to importing.  An EE expert provide the code to do that.  This is the code that is passed the spreadsheet name and location:

Private Sub fixSpreadsheetNumFormat(passedNameAndLoc As String)
 
Dim xlApp As Object, xlWb As Object, xlWs As Object
 
Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Open(passedNameAndLoc)
 
Set xlWs = xlWb.Worksheets(1)
xlWs.Range("F:P").NumberFormat = "0"
'repeat as needed
 
With xlWb
    .Save
    .Close
End With
 
Set xlWs = Nothing
Set xlWb = Nothing
xlApp.Quit
Set xlApp = Nothing
End Sub

Open in new window


I now need to do something very similar but in this case I want to format the cells on the spreadsheet as 'General', they are currently formatted as 'Date'.  
I know the routine above works but I'm not sure how so I don't know how to revise it to accomplish what I need:  Here's what I would like it to do:
If possible, starting on Row 6 of the spreadsheet (the first five rows are general info, the data starts on rows 6) for columns A - M, revise the column format to 'General'
LVL 1
mlcktmguyAsked:
Who is Participating?
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.

Martin LissOlder than dirtCommented:
xlWs.Range("A6:M" & xlWs.UsedRange.Rows.Count).NumberFormat = "General"
0

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
Martin LissOlder than dirtCommented:
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
0
Dale FyeCommented:
You should also consider going into Excel, recording a macro which accomplishes exactly what you want to do, then review the VBA code that the macro creates.  In some instances it will be a bit cumbersome, but will get you in the general vicinity you need to be in to do this yourself, so you don't have to wait for one of us to respond.

The only thing I've found annoying is that the VBA generated by Excel will frequently result in a lot of:

.Select
With Selection

End With

Syntax, which you generally don't need.
0
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 Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.