Results 1 to 5 of 5

Dynamic FormulaR1C1 Use with Column and Row Number Change.

Threaded View

  1. #1
    Registered User
    Join Date
    08-06-2012
    Location
    Albuquerque, New Mexico
    MS-Off Ver
    Excel 2010
    Posts
    12

    Dynamic FormulaR1C1 Use with Column and Row Number Change.

    I am trying to fill the selected Range (Column and row values) with a formula that goes from a starting point to a specified column, counter2, and row, counter1, but I can't seem to figure this one out. What I want is for the formula to have "r1c1"? or in this case "B1" starting point to change to C1, D1, E1, etc... to whenever counter2 ends. Also, at the same time have the first Decon_Display!RC to go from B2 to B3, B4, etc... to whenever Counter1 ends. The second Decon_Display!RC value to go from C2 to C3, C4, C5, C6, etc.. also to whenever Counter1 ends.

    So, in other words... Decon_Config!B1, C1, D1, E1, etc... >= Decon_Display!B2, B3, B4, B5, B6, etc..., Decon_Config!B1, C1, D1, E1, etc... <= Decon_Display!C2, C3, C4, C5, etc...),1,0)

    I understand that r1c1 causes B1 to be locked in all the formulas in each cell... And if you use brackets [] it does not lock it. Maybe my brain is just fried from trying to figure this out... Please help. Or maybe it is just easier to use A1 format??? I don know...


    Sub InsertFormula()
    
    Dim Counter1 As Long
    Dim Counter2 As Long
    
    With Sheets("Data")
    
        For Counter1 = 2 To .Cells(Rows.Count, "F").End(xlUp).Row
    
    With Sheets("Decon_config")
    
        For Counter2 = 2 To .Cells(2, Columns.Count).End(xlToLeft).Column
    
                   Sheets("Decon_Config").Cells(Counter1, Counter2).FormulaR1C1 = "=if(And(r1c2>=Decon_Display!RC,r1c2<=Decon_Display!RC),1,0)"
    
        Next
    End With
        Next
    End With
    
    End Sub
    Last edited by goradiar; 10-23-2012 at 05:34 AM. Reason: Solved

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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