PDA

View Full Version : [SOLVED] Excel program & left in the lurch--please help



Quadvark
11-13-2016, 10:43 PM
Hi,

I have a program that was developed for me but the programmer is no longer available. In the following routine below (line 2) I'd like to be able to have the "S" value multiplied by 12 (S*12) but every way I try to get it to work, i.e. to add double quotations, parenthesis, etc around the S value, I always get an error when executing the macro.

Can someone please tell me how to get this to work?

Much thanks,

Quadvark

For r = md2.startRow To md2.endRow - 1
Range("A" & r) = "=(C" & r & " + E" & r & " + Q" & r & " + S" & r & ")/4"
Range("A" & r).NumberFormat = "0.0"
Next

mana
11-14-2016, 04:30 AM
Range("A" & r) = "=(C" & r & "+E" & r & "+Q" & r & "+12*S" & r & ")/4"

p45cal
11-14-2016, 07:31 AM
Without looping:
With Range("A" & md2.startRow & ":A" & md2.endRow - 1)
.FormulaR1C1 = "=(RC[2]+RC[4]+RC[16]+12*RC[18])/4"
.NumberFormat = "0.0"
End With

Quadvark
11-14-2016, 08:35 AM
With Range("A" & md2.startRow & ":A" & md2.endRow - 1)
.FormulaR1C1 = "=(RC[2]+RC[4]+RC[16]+12*RC[18])/4"
.NumberFormat = "0.0"
End With


Looks like I came to the right place to get this answered. I really appreciate the help from both, mana & p45cal, so thanks so much!

Quadvark
11-14-2016, 08:42 AM
Thank you mana.

Quadvark
11-14-2016, 08:49 AM
I'll quit why I am ahead with all the thank you posts as it really shows I haven't worked in a forum much with my repeated replies saying as much. :bug:

I'll do better in the future as I am sure I will be back. And as I've said before...thanks for your help.