English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need to write a macro using visual basic. I want to divide Cells R153:R170 of a sheey by 1000. That's all. Can someone help me????

2006-11-02 23:41:32 · 5 answers · asked by katerinazach 1 in Computers & Internet Programming & Design

5 answers

the macro below divides each cell by 1000

Sub MyDividingMacro()
Dim Cell As Range
For Each Cell In Range("R153:R170")
Cell = Cell / 1000
Next Cell
End Sub

the following one divides the sum of (R153:R170) by 1000

Sub MySumMacro()
Dim Cell As Range
Dim mySum As Single
For Each Cell In Range("R153:R170")
mySum = mySum + Cell
Next Cell
MsgBox "sum = " & mySum, vbOKOnly + vbInformation
End Sub

2006-11-03 07:11:15 · answer #1 · answered by Anonymous · 0 0

I am on linux system I can help when I shift to win system most probably to this night.

Try this.
record a macro giving name and doing nothing.
stop recording.
select edit the macro in macros. Vb Editor will be opened like this.

private sub

sub

then enter some thing

msgbox sum(r153:r170)/1000

press F5

it gives a message box summing up from r153 to r170 and divides it with 1000

if this is not you are not looking then ask again with more details.

OOps some one answered better than me.

=sum(r153:r170)/1000 in any cell

2006-11-03 00:03:14 · answer #2 · answered by siva - The matrix 1 · 0 0

I'm assuming that this is an Excel scripting question? If this is the case, then why is a macro needed? Surely a formula along the lines of "=R153/1000" and a bit of "fill down" should suffice?

Rawlyn.

2006-11-02 23:52:36 · answer #3 · answered by Anonymous · 0 0

if you're utilizing vista and it's in a compressed folder all you ought to do it double click on it and it'll open, if it used to be zipped with winRAR then you can use winRAR to open it. Try double clicking the folder, if its winrar then winrar will open if its anything else then for you to open. you ought to extract the documents onto laptop or files or whereever you desire o positioned the documents.

2016-09-01 06:32:49 · answer #4 · answered by durfee 4 · 0 0

put this formula inside cell r172:

=sum(r153:r170)/1000

cheers and good luck!

mercury of love

2006-11-03 00:10:13 · answer #5 · answered by mercury of love 4 · 0 0

fedest.com, questions and answers