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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveCell.FormulaR1C1 question

Status
Not open for further replies.

fgrasso

IS-IT--Management
Jul 12, 2001
55
IT
Hi, im starting to use vba to create a macro that do this:

I have a worksheet named "gironi" and i need to take value of cell R5, R14, R23 and so on with increment of 9 and display these value with this logic:

r5 into a1
r14 into b1
r23 into a2
r32 into b2
r41 into a3
r50 into b4

and so on...

I produce this (that obviosly you can image not work):
Dim i

Dim Inizio

Inizio = 5

For i = 1 To 16

Tinizio = Str(Inizio)

ActiveCell.FormulaR1C1 = "=gironi!R[" & Tinizio & "]C[15]"
Range("C4").Select
Inizio = Inizio + 9

Tinizio = Str(Inizio)

ActiveCell.FormulaR1C1 = "=gironi!R[" & Tinizio & "]C[15]"

Next i

End Sub

I have error on these lines:
ActiveCell.FormulaR1C1 = "=gironi!R[" & Tinizio & "]C[15]"

How can i format in order to work?

Thanks for help!!
Fabio

 
hi,

Code:
    Dim r As Range, iInterval As Integer, iCol As Integer, lRow As Long
    
    Set r = [R5]
    iInterval = 9
    lRow = 1
    iCol = 1
    
    Do
        Sheets("gironi").Cells(lRow, iCol).Value = r.Value
        lRow = lRow + 1
        If lRow = 3 Then
            lRow = 1
            iCol = iCol + 1
        End If
        Set r = Sheets("gironi").Cells(r.Row + iInterval, r.Column)
    Loop While Not IsEmpty(r)

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top