Copying only whole numbers across

I have the following code that transfers only the numbers across to I1.

Sub CollectToReturn()
Dim Rng As Range
Dim NewDestination As Range
Range("A:D").SpecialCells(xlCellTypeConstants, xlNumbers).Copy Range("I1")
Set NewDestination = Range("I1")
For Each Rng In Cells.SpecialCells(xlCellTypeConstants, xlNumbers).Areas
    Rng.Copy Destination:=NewDestination
    Set NewDestination = NewDestination.Offset(Rng.Rows.Count)
Next Rng
End Sub

I only what the whole numbers and not the percentages copied across.  Does anyone have an idea on how to do this?

Thanks

Greg
TestEE.xlsm
greg_cAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KimputerCommented:
Please note I commented out one line, because I think that's not what you need (I get double data in I columns).
Also, this code works if you consistently setup up the data as in the excel test file, the percentages are visible because of the cell format. If in the future you forget the cell formatting (cell will show 0.83 instead of 83%), the code will also no work.


Sub CollectToReturn()
Dim Rng As Range
Dim NewDestination As Range
'Range("A:D").SpecialCells(xlCellTypeConstants, xlNumbers).Copy Range("I1")
Set NewDestination = Range("I1")
For Each Rng In Cells.SpecialCells(xlCellTypeConstants, xlNumbers).Areas
    counter = 0
    For Each r In Rng.Rows
        If r.Cells(1).NumberFormat <> "0%" Then
        counter = counter + 1
        r.Copy NewDestination
        End If
        
        
    Next
    Set NewDestination = NewDestination.Offset(counter)
Next Rng
MsgBox "done"
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
greg_cAuthor Commented:
Perfect.  Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.