Short VB code for PasteValue

S

slc

Hi,

I have these 2 lines of code which I hope to shorten it to 1 line.
Anyone have any idea how to do it?

Basically, I want to convert the formula in A1 to A3 to its value. In
the nutshell, I do a copy in range A1:A3 and then do a "Paste Special"
with values only.

Thanks for your help.

...start...
Range("A1:A3").Copy
Range("A1:A3").PasteSpecial Paste:=xlPasteValues
...end...
 
R

RADO

Try this:

Range("A1:A3").Value=Range("A1:A3").Value

No need to copy and paste.

Best -

RADO
 
G

gocush

Sorry. I wasn't paying attention to the 2 lines to 1 part of you
question.

I have never found a way to do this with one line
 
S

slc

Paul & Rado,

Thanks for your help. This 1-liner works fine for me.

...start...
Range("A1:A3").Value=Range("A1:A3").Value
...end..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top