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,
Bookmarks