Macro to format data..

Hi Experts using excel 2010

Need a macro to replace all the blank cells in columns s:u start at row 2 until last cell in each column based on column A with 0 and format the numbers to 1,000,000 format.

The work book has over 3000 rows of data
route217JuniorAsked:
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:
Can you attach your workbook or a sample one?
0
route217JuniorAuthor Commented:
Will do...not at the moment..
0
route217JuniorAuthor Commented:
Hi martin. Internet is working..ill post workbook today.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Zeth LarssonCommented:
Try this.
In my swedish version of XL, I have some trouble with the comma you want.
We have comma as decimal separator and space before.
But I hope this will work on you version.

Sub resetAndFormat()
    Dim lngRow As Long
    lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
    ActiveSheet.Range(Cells(2, "s"), Cells(lngRow, "u")).Select
    With Selection
        .Value = 0
        .NumberFormat = "#,###,##0"
    End With
End Sub
0
route217JuniorAuthor Commented:
Many thanks Seth for the feedback.
0
ShumsDistinguished Expert - 2017Commented:
Hi,

I wont prefer Active Sheet & Select process, rather define specific sheet & range:
Sub FormatData()
Dim Ws As Worksheet
Dim LRow As Long
Set Ws = Worksheets("Sheet1") 'Change sheet name here
LRow = Ws.Range("A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
With Ws.Range("S2:U" & LRow).SpecialCells(xlCellTypeBlanks)
    .Value = 0
    .NumberFormat = "#,###,##0"
End With
Application.ScreenUpdating = True
End Sub

Open in new window

Change Sheet name as required.
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
route217JuniorAuthor Commented:
Many thanks shums
0
ShumsDistinguished Expert - 2017Commented:
Please check and let me know.
0
Zeth LarssonCommented:
Thanks route217
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 Office

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.