Apply a formula to every numerical value in a selection/workbook.

  • Thread starter Thread starter chusker15
  • Start date Start date
C

chusker15

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

Any help would be appreciated.

Thank
 
You might consider usi
--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
ng Tools>Options>Calculation, Precision as displayed
 
Sorry. I meant:

You might consider using

Tools>Options>Calculation, Precision as displayed

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
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
 

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

Back
Top