PDA

View Full Version : How do i Copy numbers only.



TheAnswer
12-10-2010, 01:11 AM
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

New- Syndicated Facility

Received ....
Processed 1
Completed 1

I am trying to copy the numbers over without the "." from received. What should i do to the coding in order to achieve the desired result?

Appreciate all helps.:D

macropod
12-10-2010, 03:36 AM
Please explain:

I am trying to copy the numbers over without the "." from received.
From where do the copied strings originate (eg another workbook, a text file)? Are the '.' strings strings of period characters (eg ...) or, say, an elipsis (ie …)? If they're simply the result of cell formats in Excel, your Paste-Special code wouldn't replicate them, so they'd have to be actual cell content. Is there a reason you can't delete them (via code) at the source before copying, or at the destination after pasting?

TheAnswer
12-12-2010, 06:16 PM
Please explain:

From where do the copied strings originate (eg another workbook, a text file)? Are the '.' strings strings of period characters (eg ...) or, say, an elipsis (ie …)? If they're simply the result of cell formats in Excel, your Paste-Special code wouldn't replicate them, so they'd have to be actual cell content. Is there a reason you can't delete them (via code) at the source before copying, or at the destination after pasting?

It is from another workbook. '.' is the strings of period character. I cant delete them because we are not suppose to modify the source and destination:) Are there any solutions to it?

mikerickson
12-12-2010, 06:58 PM
Dim oneArea as Range
For each oneArea in SourceRange.SpecialCells(xlCellTypeConstants, xlNumbers).Areas
DestinationRange.Offset(oneArea.Row - SourceRange.Row, oneArea.Column - SourceRange.Column).Resize(oneArea.Rows, oneArea.Columns).Value = oneArea.Value
Next oneArea

macropod
12-12-2010, 11:53 PM
I cant delete them because we are not suppose to modify the source and destination
Well, if you can't modify either the source or the destination, you can't use a copy/paste process, since you need to parse out the unwanted strings before inserting the wanted parts into the destination. Mike's code, which I haven't tested, might do what you need.