+ Reply to Thread
Results 1 to 3 of 3

Formula R1C1 problem

Hybrid View

  1. #1
    Registered User
    Join Date
    04-12-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    96

    Unhappy Formula R1C1 problem

    Hi, all. I need to use a loop to run through the necessary column, and if match the condition, then autofill the column's data to desired column. but when the macro run to ActiveCell.FormulaR1C1 = "=RC[-123+i]" , it got error msg says : run time error"1004" Application-defined or object-defined error? how should i modify this problem?? Please help. Thank you!
    
    i = 28
            Do While i <= 41
             If range("GP3").Value = Cells(4, i).Value Then
              If range("GP4").Value = Cells(5, i).Value Then
                range("GP8").Select
                ActiveCell.FormulaR1C1 = "=RC[-123+i]"
                selection.AutoFill Destination:=range(Cells(8, "GP"), Cells(GrandTotalRowCount, "GP")), Type:=xlFillDefault
              End If
             End If
             i = i + 1
            Loop
    Last edited by yjmmay34; 07-19-2010 at 03:19 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373

    Re: Formula R1C1 problem

    Try:

    ActiveCell.FormulaR1C1 = "=RC[" & (-123 + i) & "]"

  3. #3
    Registered User
    Join Date
    04-12-2010
    Location
    singapore
    MS-Off Ver
    Excel 2007
    Posts
    96

    Re: Formula R1C1 problem

    Thank you so much lecxe. it can work perfectly. Have a nice day!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1