![]() |
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? |
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? |
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? |
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 |
All times are GMT +1. The time now is 02:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com