Value.Formula Error

  • I'm good at making small changes to VBA code but this is next level for me.


    I keep getting errors when I try to run the macro with the new addtion I added to the K Col.
    '.Range("k" & lastrow.Formula = "=IF(INDEX(Data!$I:$I,$AC15)="A","",INDEX(Data!$I:$I,AC15))"


    The base formula
    =IF(INDEX(Data!$I:$I,$AC15)="A","",INDEX(Data!$I:$I,AC15))
    I know I need the replace 15 with & LastRow but I believe the IF formula with the "" are causing the errors in the code.


    Can anyone please help



  • Try

    Code
    .Range("k" & LastRow).Formula = "=IF(INDEX(Data!$I:$I,$AC" & LastRow & ")=""A"","""",INDEX(Data!$I:$I,AC" & LastRow & "))"

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Thank you!

    Code
    .Range("k" & LastRow).Formula = "=IF(INDEX(Data!$I:$I,$AC" & LastRow & ")=""A"","""",INDEX(Data!$I:$I,AC" & LastRow & ))"


    It accepted the VBA formula with the end "))" correcting to ))"
    Code executes, but its not working :/ more troubleshooting,


    Any suggestions on where to look for the troubleshooting?


    Do I need to set data as a worksheet in vba?
    So

    Code
    Dim wsData as Worksheet
  • Attach your workbook.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • I found a temp a workaround I put the original index formula on the daily input sheet and I told the vba code to get that Cells value.
    I will attach the workbook this weekend, but honestly I think I can live with this, I set the background white and the text white so you don't even know its there.


    I'm really struggling with these VBA excel formulas


    Code
    .Range("L" & LaswRow.Formula = "=If(Y & LastRow & ">=Time(1,15,0),1,"""")"


    =IF (Y6>Time(1,15,0),1,"")


    Attempted to use the Macro recorder to get an idea but not much help

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!