Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove dashs from macro data


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Remove dashs from macro data

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Remove dashs from macro data


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove dashs from social security numbers Hemi Excel Discussion (Misc queries) 4 December 18th 08 10:48 PM
Help needed with Pivot table macro to remove data Nelly Excel Programming 1 June 10th 06 01:56 AM
Is there a macro to identify and remove duplicate data in Excel? Cindy Lou Excel Worksheet Functions 3 March 9th 06 03:10 AM
How do I Remove bullets from text data in Excel cell with macro? David McRitchie Excel Programming 0 September 19th 04 09:22 PM
Looping Macro to remove data where value is 0 Paul Excel Programming 3 January 10th 04 08:08 AM


All times are GMT +1. The time now is 09:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"