using range in formula

J

jeffP

Hello all,
Another simple question. What I want do here is do this
formula down through column B. B1 would be A1*increase, B2
would be A2*increase, etc.
I know this is simple enough to do in Excel but.... I'm
trying to learn VBA.


dim increase as integer
increase = Range("H1")

For Each c In Sheets("sheet1").Range("A1:A10")

c.Value = Range("B1") * increase
Next c

Which brings me to my second question. Does anyone (or
website) have sample or old SS w/ code that I could have
to see how simple things work. Some code is basic and
repeating (how to hide a row, how to enter a custom
toolbar)and needed to use VB code realistically. I'm
learning but it's taking forever reading help files and
this newsgroup. When I can record a macro and look at it ,
things make more sense so I was hoping.....

THanks in advance for any and all help
jeffP
 
S

Samura

Is this a macro what you would like to do?


Dim increase As Integer
Dim j As Integer

increase = Range("H1")

For j = 1 To 10
Range("B" & j).Value = Range("A" & j).Value * increase
Next
 
B

Bob Phillips

Try using the Macro Record facility which will give you a good start.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
J

jeffP

That was exactly want I needed to know. How to assign a
variable to the row and keep the column the same.
Thank you.
 
J

jeffP

Bob,
Actually that's exactly what I've been doing, and I am
learning (slowly) but I miss key things like Samura just
showed me . Assigning a variable row # to a static column.
jeffP
 
Top