Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default 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,

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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,

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default 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,

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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,

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default 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,



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default 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,


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 83
Default 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,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum Formula for cell range Shopgirl Excel Discussion (Misc queries) 1 May 9th 08 02:54 AM
How can I make a blank cell in a formula cell with a range of cell Vi Excel Discussion (Misc queries) 5 June 21st 07 02:46 PM
VBA for Last Cell in Formula Range [email protected] Excel Discussion (Misc queries) 3 May 9th 07 06:47 PM
Need a formula that finds the last used cell in a range samfw Excel Worksheet Functions 4 February 6th 06 03:30 PM
formula for named cell/range using cell values alex Excel Worksheet Functions 2 August 27th 05 06:44 PM


All times are GMT +1. The time now is 08:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"