ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   devide the whole column... (https://www.excelbanter.com/excel-programming/295755-devide-whole-column.html)

mowen

devide the whole column...
 
Hi
I'm looking for a simple vba code to devide the whole column with
spesific value?

example
devide column A with 1000 without any temporary cell and exclude th
empty cell in the column.

best regards
Run

--
Message posted from http://www.ExcelForum.com


Frank Kabel

devide the whole column...
 
Hi
before we go into VBA you may consider the following
procedu
- enter 1000 in an empty cell and copy this cell
- select your target range
- hit F5, click 'Special' and choose 'Constants'
- goto 'Edit - Paste Special and choose the action 'Divide'

Now the VBA way:
sub divide_all
dim rng as range
dim cell as range
dim divisor

set rng = selection
divisor =1000
for each cell in rng



-----Original Message-----
Hi
I'm looking for a simple vba code to devide the whole

column with a
spesific value?

example
devide column A with 1000 without any temporary cell and

exclude the
empty cell in the column.

best regards
Rune


---
Message posted from http://www.ExcelForum.com/

.


Frank Kabel

devide the whole column...
 
Hi
sorry the VBA code got interrupted. Try

sub divide_all()
Dim rng as range
Dim cell as range
dim divisor
set rng = selection
divisor = 1000
application.screenupdating=false
for each cell in rng
if isnumeric(cell.value) then
cel.value=cell.value/divisor
end if
next
application.screenupdating=true
end sub

-----Original Message-----
Hi
I'm looking for a simple vba code to devide the whole

column with a
spesific value?

example
devide column A with 1000 without any temporary cell and

exclude the
empty cell in the column.

best regards
Rune


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 10:30 PM.

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