View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sergei D Sergei D is offline
external usenet poster
 
Posts: 15
Default stupid round question

this seems logical and should work. But.. i get: "object variable or with
object variable not set" error message.
--
Sergei D


"somethinglikeant" wrote:

To Format a column to 2 d.p

:=======================
Sub RoundColumn()
Columns("A:A").NumberFormat = "#,##0.00"
End Sub
:=======================

To round each value in a selection to 2 d p

:=======================
Sub RoundColumnValue()

Dim cl As Range

For Each cl In Selection
cl.Value = Application.WorksheetFunction.Round(cl.Value, 2)
Next cl

End Sub

:=====================

http://www.excel-ant.co.uk