Modify VBA to copy and paste.

LUIS FREUND
LUIS FREUND used Ask the Experts™
on
I have this VBA code that copies and paste and it works great except when I have this in a cell:  744350E00, when I run the code it changes it to 7.44E+05.  I wanted to keep the same format.   Below is the code.  Can the code be modified to not convert it to a scientific format?

Sub Sort()
With Worksheets("MAIN_PN").Range("A4:K500")
    .Value = .Value
End With
End Sub
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Format the cell as Text.
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
Like this...

Sub Sort()
With Worksheets("MAIN_PN").Range("A4:K500")
    .NumberFormat = "@"
    .Value = .Value
End With
End Sub

Open in new window

Author

Commented:
AWESOME!  THANK YOU!
Subodh Tiwari (Neeraj)Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome Luis!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial