Is there a simple macro to copy a number from one column, round it to 0 decimal places and place in another column but not the same rows down?

yblcolin

New Member
Joined
Aug 30, 2023
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Is there a simple macro to copy a number from one column, round it to 0 decimal places and place in another column but not the same rows down?

1693406601147.png

3352.76
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi yblcolin- welcome to the MrExcel Board. Yes, with a couple of clarification questions, this would appear to be a straightforward simple code.

That said, due to it's apparent simplicity, you may be better served, if you used the Excel built-in Macro recorder to see how it can be done. If you don't know how to use it, a simple search will yield plenty of instructions.
 
Upvote 0
As I'm old, I used to use Lotus 123 and setting up macros in that was very easy. I have tried recording macros but never had any success, probably because I'm IT stupid. The stumbling block seems to be the lack of an 'End' function in Excel macros.
 
Upvote 0
Seeing as I can't tell by your image exactly what the cell references are, the macro below takes the value in E5 and rounds it to zero decimal places in I1, is that what you want... if not then I need more info

Book1.xlsb
EFGHI
13353
2
3
4
53352.76
6
Sheet3


VBA Code:
Sub RoundOffset()
Range("E5").Offset(-4, 4).Value = Round(Range("E5").Value, 0)
End Sub
 
Upvote 0
Assuming @MARK858 cell references are correct, and this is the only thing you want to accomplish, why not just do it with a formula...

Book1
ABCDEFGHIJ
11609.181609.18gfMD-60 V2, 1.2mm gauge decking, 150mm deep3353m2
21267.121267.121f
3476.46476.462f
4-----------
53352.76
Sheet1
Cell Formulas
RangeFormula
I1I1=ROUND(SUM(E1:E3),0)
E5E5=SUM(E1:E3)
 
Upvote 0
Assuming @MARK858 cell references are correct, and this is the only thing you want to accomplish, why not just do it with a formula...
Maybe because of this part of the question
Is there a simple macro to copy a number

and the way the question is worded i.e
and place in another column
seems more fitting to a vba offset rather than a formula, where you are putting the formula in a known cell rather than in relation to the original cells position
 
Upvote 0
Maybe because of this part of the question
Yes, I get that part (see my post #2), but the OP is not exactly forthcoming with details, hence my question... I guarantee there is more to this than what is conveyed in Post #1.
 
Upvote 0
I guarantee there is more to this than what is conveyed in Post #1.
I'm sure there is but I posted the code because the OP specifically asked for code, and with no more details (or reasons why they asked for a macro i.e. it might be part of a bigger procedure) I stuck to what the OP has asked for (I also note that you suggested using the macro recorder to get the code needed)
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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