Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- Optitro ----------------------------------------------------------------------- Optitron's Profile: http://www.excelforum.com/member.php...fo&userid=2672 View this thread: http://www.excelforum.com/showthread.php?threadid=56474 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
DestCell.Offset(0, 5).Value = Replace( _
actWks.Cells(iRow, "N").Value,"-","") -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Optitron" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank you gentlemen. That worked perfectly. -- Optitron ------------------------------------------------------------------------ Optitron's Profile: http://www.excelforum.com/member.php...o&userid=26729 View this thread: http://www.excelforum.com/showthread...hreadid=564748 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
remove dashs from social security numbers | Excel Discussion (Misc queries) | |||
Help needed with Pivot table macro to remove data | Excel Programming | |||
Is there a macro to identify and remove duplicate data in Excel? | Excel Worksheet Functions | |||
How do I Remove bullets from text data in Excel cell with macro? | Excel Programming | |||
Looping Macro to remove data where value is 0 | Excel Programming |