Macro to round down cells in a column

Tom Allen

Board Regular
Joined
Sep 26, 2014
Messages
92
Hi I have looked through various forum threads regarding my problem but I am unable to find anything that solves what I am looking to achieve.

I am looking to create a macro that rounds down all the values of column D.

So for example even if a value in a cell from column D is 6.98 it would round down to 6.

If anyone could provide assistance on this I would greatly appreciate it.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If there is a better way I would definitely use that, I'm all ears.

Currently I have data that I have imported from another workbook and now I need to round the values down in the same column.
 
Upvote 0
something like
=ROUNDDOWN(G8,0)

will round down the number in g8 (if 6.98 is in g8, the result would be 6)
 
Upvote 0
Thanks, yeah I managed to figure that formula out but I need the same results to be carried out via a macro.
 
Upvote 0
You could give this a go, assumes the data starts on row 2.

Code:
Sub m()
With Range("D2:D" & Range("D" & Rows.Count).End(xlUp).Row)
    .Cells = Evaluate("=INDEX(ROUNDDOWN(" & .Address & ",0),0)")
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top