ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add same formula to every cell in the range (https://www.excelbanter.com/excel-discussion-misc-queries/197965-add-same-formula-every-cell-range.html)

Eastar

Add same formula to every cell in the range
 
data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,


Gary''s Student

Add same formula to every cell in the range
 
Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,


Eastar

Add same formula to every cell in the range
 
Thank you Gary, this works.
by the way, can we do this without macro?

thanks,

"Gary''s Student" wrote:

Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,


Gary''s Student

Add same formula to every cell in the range
 
You can do it by manual typing, but that's a huge in in the a$$. Using the
macro is not too bad:


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To use the macro from the normal Excel window:

1. ALT-F8
2. Select the macro
3. Touch Run



To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200798


"Eastar" wrote:

Thank you Gary, this works.
by the way, can we do this without macro?

thanks,

"Gary''s Student" wrote:

Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,


Eastar

Add same formula to every cell in the range
 
Thank you very much Gary. That is great!

"Gary''s Student" wrote:

You can do it by manual typing, but that's a huge in in the a$$. Using the
macro is not too bad:


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To use the macro from the normal Excel window:

1. ALT-F8
2. Select the macro
3. Touch Run



To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Gary''s Student - gsnu200798


"Eastar" wrote:

Thank you Gary, this works.
by the way, can we do this without macro?

thanks,

"Gary''s Student" wrote:

Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,


Gord Dibben

Add same formula to every cell in the range
 
Using another column as a helper.

Assuming numbers are in column A and column B as shown

In C1 enter =ROUND(A1,0) copy to D1

Select C1 and D1 then Double-click to copy down.


Gord Dibben MS Excel MVP

On Thu, 7 Aug 2008 12:45:01 -0700, Eastar
wrote:

Thank you Gary, this works.
by the way, can we do this without macro?

thanks,

"Gary''s Student" wrote:

Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,



Jake

Add same formula to every cell in the range
 
I notice that when the below rounding macro is used on a formula instead of a
number, it converts the formula to its calculated number. Is there a macro
that will add the +ROUND() to cells while preserving the formula within the
cell? Thanks in advance for your help!

"Gary''s Student" wrote:

Select the cells you want to convert and run this macro:

Sub round_um()
Set rr = Selection
For Each r In Selection
r.Formula = "=ROUND(" & r.Value & ",0)"
Next
End Sub

--
Gary''s Student - gsnu200798


"Eastar" wrote:

data shown as below
a b
1 5.2312 6.1231
2 15.2323 15.46463

How can I add a round() formula to every cell without doing that to each of
them seprately?

thanks,



All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com