Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cell selection in Excel - macro problem

Status
Not open for further replies.

collierd

MIS
Dec 19, 2001
509
DE
Hello

Within Excel, using the following data:

Code:
     C1       C2        C3       C4       C5      ..to C13
R1           Leeds
R2
R3
R4   Sales   Jul-06   Aug-06   Sep-06   Oct-06    ..to Dec

I am trying to get the following results:

Code:
id
Leeds*Jul-06*Sales
Leeds*Aug-06*Sales
Leeds*Sep-06*Sales
Leeds*Oct-06*Sales
.. to Dec-06


I have the following code:

Code:
Dim rowReference As Integer
   Dim i As Integer
   
   rowReference = 2
   For i = 1 To 12
      ActiveCell.FormulaR1C1 = _
        "=budget!R1C2 & ""*"" & budget!R4C[1] & ""*"" & budget!R[-3]C1"
      Range("A" & rowReference).Select
      rowReference = rowReference + 1
   Next i

The problem lies with budget!R4C[1] & ""*"" & budget!R[-3]C1
How do I get this to make use of the variable i in its selection?

Thanks

Damian.
 
Fixed it:

Seems to be where the quotes are

Code:
"=budget!R1C2 & ""*"" & budget!R4C[" & i & "] & ""*"" & budget!R4C1"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top