Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Short VB code for PasteValue


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...


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Short VB code for PasteValue


change it slightly to

Range("A1:A3").PasteSpecial xlPasteValues


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Short VB code for PasteValue

Try this:

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

No need to copy and paste.

Best -

RADO


"slc" wrote in message
...

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...


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Short VB code for PasteValue


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

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Short VB code for PasteValue


This is better.

I wonder why xl has xlPasteValues the

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Short VB code for PasteValue


Paul & Rado,

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

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

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

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
short cut Sathisc[_19_] Excel Discussion (Misc queries) 2 May 26th 09 11:45 PM
Need a short cut for this... Eddy Stan Excel Worksheet Functions 5 February 20th 06 12:37 PM
PasteValue Without Selecting Tom Ogilvy Excel Programming 0 August 18th 03 12:50 AM
PasteValue Without Selecting William[_2_] Excel Programming 0 August 18th 03 12:41 AM
A code problem with short Estimating worksheets Stuart[_5_] Excel Programming 1 July 16th 03 11:36 PM


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

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

About Us

"It's about Microsoft Excel"