divide cells using macro

  • Thread starter Thread starter leg
  • Start date Start date
L

leg

Hi people,

i'm trying to write a macro to divide some cells by 1000.

i have a table with the values in there, and i need to divide the
values by 1000 and put the new values in the same table. i don't know
if this is posible, but it whould be great if it is!
;)


Thank you very much!
 
Hi leg,

Unless you need to do this often, you could put 1000 into an unused cell,
select the range you want to update and use Edit|Paste Special|Values:Divide

For a macro-based solution, you could use:
Sub Divide()
Dim oCell As Range
On Error Resume Next
For Each oCell In Selection
If oCell.Value <> "" Then oCell.Value = oCell.Value / 1000
Next oCell
End Sub

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

macro to divide by zero 2
Divide By 6
Run Macro If Cell have "x" value 0
Cell input to automatically divide itself 9
Macro help 2
help with an array formula 3
Using current date track budget. 1
VBA if loop 6

Back
Top