ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using range in formula (https://www.excelbanter.com/excel-programming/302070-using-range-formula.html)

jeffP

using range in formula
 
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

SAMURA

using range in formula
 
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


--
Samura


"jeffP" wrote in message
...
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



Bob Phillips[_6_]

using range in formula
 
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)

"jeffP" wrote in message
...
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




Jeffp

using range in formula
 
That was exactly want I needed to know. How to assign a
variable to the row and keep the column the same.
Thank you.
-----Original Message-----
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


--
Samura


"jeffP" wrote in message
...
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


.


Jeffp

using range in formula
 
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
-----Original Message-----
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)

"jeffP" wrote in message
...
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



.



All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com