Macro help please

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Macro help please

In a sheet1, range A1 to D1000 has datas...including customers account number. I want the macro to replace all the account number with dats.
I want all the numbers no matter what kinda number it is from 1-10 replace it with dots...

Please design a macro...

Thanks again!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Code:
Sub blah()
For Each Cll In Range("A1:D1000").Cells
  For i = 0 To 9
  Cll.Value = Replace(Cll.Value, CStr(i), ".")
  Next i
Next Cll
End Sub
be aware it will replace any formulae with values, and make sure the right sheet is the active sheet before running it.
 
Upvote 0
Try

Code:
Sub Dots()
Dim LR As Long, i As Long, j As Integer, c As Range
LR = Range("A" & Rows.Count).End(xlUp).Row
For Each c In Range("A1:D" & LR)
    For j = 0 To 9
        c.Value = Replace(c.Value, j, ".")
    Next j
Next c
End Sub

Edit: Drat! :)
 
Upvote 0

Forum statistics

Threads
1,215,740
Messages
6,126,585
Members
449,319
Latest member
iaincmac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top