Hi
Please help me to create VBA code. If selected columns cells contain number then rounding off formula to be added ( Round,0) if any cells does not have numbers, to be ignored round formua.( In my range of columns I have text and blank cell also)
Hi
Please help me to create VBA code. If selected columns cells contain number then rounding off formula to be added ( Round,0) if any cells does not have numbers, to be ignored round formua.( In my range of columns I have text and blank cell also)
Choose a better way for you.![]()
Sub Round_1() Selection.SpecialCells(xlCellTypeConstants, 1).NumberFormat = "0" End Sub Sub Round_2() Dim rng As Range, e As Range Set rng = Selection.SpecialCells(xlCellTypeConstants, 1) For Each e In rng e = WorksheetFunction.Round(e, 0) Next End Sub
Best Regards,
Maras.
Hi Maras_mak. Thank you so much. The below codes i expected.
Sub Round_2()
Dim rng As Range, e As Range
Set rng = Selection.SpecialCells(xlCellTypeConstants, 1)
For Each e In rng
e = WorksheetFunction.Round(e, 0)
Next
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks