View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Apply a formula to every numerical value in a selection/workbook.

Against the selection:

Option Explicit
Sub testme2()

Dim myRng As Range
Dim myCell As Range

Set myRng = Nothing
On Error Resume Next
Set myRng = Selection.Cells.SpecialCells(xlCellTypeConstants, xlNumbers)
On Error GoTo 0

If myRng Is Nothing Then
'no numbers
Exit Sub
End If

For Each myCell In myRng.Cells
'do your stuff
Next myCell

End Sub




chusker15 wrote:

I have several very large workbooks and I need to convert every number
in the workbooks to a certain number of significant digits. I have
already made a user defined formula to round any number to a set number
of significant digits. Now I am searching for a convenient way to apply
this formula to every value in either a sheet or an entire workbook or
possibly just a selected range of values without altering the text.

Any help would be appreciated.

Thanks

--
chusker15
------------------------------------------------------------------------
chusker15's Profile: http://www.excelforum.com/member.php...o&userid=16843
View this thread: http://www.excelforum.com/showthread...hreadid=320603


--

Dave Peterson