Solved

Simple VBA - Divide E6 to E20 by 1000

Posted on 2010-11-10
5
563 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now