Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Select range -- convert formulas to values

I understand how to convert a formula to a value:
Range("A1").Formula = Range("A1").Value

Can somebody help with the syntax to use the selected range instead of
hard-coding a range into the macro?

  #2   Report Post  
Posted to microsoft.public.excel.programming
JPW JPW is offline
external usenet poster
 
Posts: 6
Default Select range -- convert formulas to values

Public Sub SelectionFormToVal()

Dim tCell as Range

If TypeName(Selection) < "Range" Then Exit Sub

For Each tCell in Selection
tCell.Formula = tCell.Value
Next tCell



"Johnny" wrote in message
oups.com...
I understand how to convert a formula to a value:
Range("A1").Formula = Range("A1").Value

Can somebody help with the syntax to use the selected range instead of
hard-coding a range into the macro?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Select range -- convert formulas to values

The following will convert formulae to values in the range you select:

Sub freeze_it()
Selection.Value = Selection.Value
End Sub

There is probably no reason to test the individual cells in the range to see
if they contain data or formula.
--
Gary's Student


"JPW" wrote:

Public Sub SelectionFormToVal()

Dim tCell as Range

If TypeName(Selection) < "Range" Then Exit Sub

For Each tCell in Selection
tCell.Formula = tCell.Value
Next tCell



"Johnny" wrote in message
oups.com...
I understand how to convert a formula to a value:
Range("A1").Formula = Range("A1").Value

Can somebody help with the syntax to use the selected range instead of
hard-coding a range into the macro?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select range -- convert formulas to values


Good afternoon Johnny

There are a few ways of doing this. Try this:

Selection.Formula = Selection.Value

or this will also do the trick:

For Each UsrCell In Selection
UsrCell.Formula = UsrCell.Value
Next UsrCell

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=380876

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
convert formulas to values MatthewFlinchem Excel Worksheet Functions 3 May 17th 06 04:39 PM
Easily convert all formulas in 3d spreadsheet to values? Jazza Excel Worksheet Functions 2 April 9th 06 04:46 AM
Convert Values to formulas TSter Excel Worksheet Functions 4 January 15th 06 09:26 PM
Convert Formulas to Values and Preserve Formatting Tenacity Excel Discussion (Misc queries) 2 August 12th 05 01:00 AM
Canīt Convert Formulas to Values with Deactivate event Rolo[_3_] Excel Programming 2 November 8th 03 09:13 PM


All times are GMT +1. The time now is 10:22 AM.

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

About Us

"It's about Microsoft Excel"