Solved

Simple VBA - Divide E6 to E20 by 1000

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

815 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

7 Experts available now in Live!

Get 1:1 Help Now