Posted to microsoft.public.excel.programming
|
|
Remove dashs from macro data
DestCell.Offset(0, 5).Value = Replace(actWks.Cells(iRow, "N").Value ,"-","")
--
Regards,
Tom Ogilvy
"Optitron" wrote:
I want to remove the -'s from the value with the red arrow below. It
moves a number from one sheet to another. The format is like this
555-55-555-5555 but I want the dashes removed when I click the macro
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 Sub
--
Optitron
------------------------------------------------------------------------
Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729
View this thread: http://www.excelforum.com/showthread...hreadid=564748
|