devide the whole column...

M

mowen

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
 
F

Frank Kabel

Hi
before we go into VBA you may consider the following
procedure:
- 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
 
F

Frank Kabel

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
 
Top