Results 1 to 3 of 3

How to add an integer to R1C1 formula?

Threaded View

  1. #1
    Registered User
    Join Date
    05-08-2020
    Location
    Budapest, Hungary
    MS-Off Ver
    O365
    Posts
    7

    Angry How to add an integer to R1C1 formula?

    Hi Guys,

    I'm relatively new in VBA programming, that's why I need some help.

    I'm using the following macro, but it doesn't work (I guess because of the reference to the "lastrow" variable).
    I have two worksheets: the first one is "value", where I want to read data from to the other worksheet "May".

    Sub firsttry()
    '
    ' firsttry Macro
        
        Sheets("May").Select
        Dim lastrow As Integer
        lastrow = Cells(Rows.Count, "A").End(xlUp).Row
        Range("C2").Select
        ActiveCell.FormulaR1C1 = _
            "=+IF(R1C[1]=value!R4C13,SUMIFS(value!R2C7:R*lastrow*C7,value!R2C1:R*lastrow*C1,""2020"",value!R2C2:R*lastrow*C2,""05"",value!R2C6:R*lastrow*C6,""A"",value!R2C5:R*lastrow*C5,May!RC1),"""")"
    The problem is, that I do not know how to refer to the lastrow variable.
    I tried various forms (R"&lastrow&"; R" & lastrow & ") etc., but it didn't work.

    Any suggestions or advice?

    A friend of mine suggested to use the Application.Worksheetfunction.If formula, but I don't know how and where to insert it.

    Thanks a lot,
    Last edited by farkasmate; 05-08-2020 at 06:34 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Help with R1C1 formula
    By kmlloyd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2015, 03:52 PM
  2. Using R1C1 formula in VBA changes all references from CELL("address") function to R1C1?
    By dmasters4919 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2014, 04:17 PM
  3. [SOLVED] Help with R1C1-formula
    By torppo in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-06-2014, 08:52 AM
  4. Replies: 2
    Last Post: 06-30-2013, 03:30 PM
  5. [SOLVED] Need to Convert Formula R1C1 into A1-style but the Formula String exceeds 255 characters
    By VBA_Gary in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-04-2012, 12:09 PM
  6. Replies: 3
    Last Post: 10-27-2011, 05:20 PM
  7. Count the number of occurrences of an integer withing a larger integer
    By nnktran in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2010, 01:04 PM

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