Solved

Simple VBA - Divide E6 to E20 by 1000

Posted on 2010-11-10
5
590 Views
Last Modified: 2012-06-22
Hi,

Simple VBA from a beginner.

How do I loop thru cells E6 to E20 and divide each cell by 1000

Thanks
0
Comment
Question by:Patrick O'Dea
  • 3
5 Comments
 
LVL 45

Accepted Solution

by:
patrickab earned 400 total points
ID: 34104605
Sub divi()
Dim i As Long

For i = 6 To 20
    Cells(i, "E") = Cells(i, "E") / 1000
Next i

End Sub
0
 
LVL 13

Assisted Solution

by:gbanik
gbanik earned 100 total points
ID: 34104711
There is a direct solution without a VBA.

Type 1000 in A1 (assuming it is empty). Select A1 and hit CNTRL + C (copy it). Now select range E6 to E20. Right click and Paste special. In the options, Select Divide in "Operation". Enjoy!!
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34104743
I tend to forget that option, but then 21Dewsbury did imply a VBA solution was required.
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 34105416
Thanks all.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 34105624
21Dewsbury - Thanks for the grade & points - Patrick
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question