ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how do i square all items in a colums w/out doinf it one-by-one? (https://www.excelbanter.com/excel-discussion-misc-queries/55884-how-do-i-square-all-items-colums-w-out-doinf-one-one.html)

excellent person

how do i square all items in a colums w/out doinf it one-by-one?
 
I used the random number generator to generate 1000 numbers. Now I want to
square all 1000 items but obviously I dont want to do it one-by-one. How can
I do this instantly?

Norman Jones

how do i square all items in a colums w/out doinf it one-by-one?
 
Hi Excellent Person.

Try:

'============
Sub SquareEm()
Dim Rng As Range
Dim rCell As Range

Set Rng = Selection
For Each rCell In Rng.Cells
rCell.Value = rCell.Value ^ 2
Next rCell

End Sub
'<<============

If you are not familiar with macros, you may wish to visit David McRitchie's
'Getting Started With Macros And User Defined Functions' at:

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

---
Regards,
Norman


"excellent person" <excellent wrote in
message ...
I used the random number generator to generate 1000 numbers. Now I want to
square all 1000 items but obviously I dont want to do it one-by-one. How
can
I do this instantly?




Biff

how do i square all items in a colums w/out doinf it one-by-one?
 
Hi!

Select the range of numbers.

Goto EditCopy

EditPaste SpecialMultiplyOK

Biff

"excellent person" <excellent wrote in
message ...
I used the random number generator to generate 1000 numbers. Now I want to
square all 1000 items but obviously I dont want to do it one-by-one. How
can
I do this instantly?





All times are GMT +1. The time now is 01:43 PM.

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