Remove dashs from macro data

O

Optitron

I want to remove the -'s from the value with the red arrow below. I
moves a number from one sheet to another. The format is like thi
555-55-555-5555 but I want the dashes removed when I click the macr
button:

Sub ORDER1()
Dim toWks As Worksheet
Dim actWks As Worksheet
Dim myRng As Range
Dim myCell As Range
Dim iRow As Long
Dim DestCell As Range

Set actWks = ActiveSheet
Set toWks = Worksheets("ORDER")

Set myRng = Intersect(Selection.EntireRow, actWks.Range("a:a"))

With toWks
Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

With toWks
For Each myCell In myRng.Cells
iRow = myCell.Row
DestCell.Value = actWks.Cells(iRow, "a").Value
DestCell.Offset(0, 5).Value = actWks.Cells(iRow, "N").Value <==
DestCell.Offset(0, 11).Value = actWks.Cells(iRow, "F").Value
Set DestCell = DestCell.Offset(1, 0) '<<<changed
Next myCell
End With
End Su
 
B

Bob Phillips

DestCell.Offset(0, 5).Value = Replace( _
actWks.Cells(iRow, "N").Value,"-","")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

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