HELP!!! I can't set formula to cell

Joined
Jul 30, 2017
Messages
2
Reaction score
0
hi i'm trying to programmatically pull a formula then add a new user to that formula and then set the cell with the new formula

here's what i got

Dim SATURDAY_DEPART_TIME_INITAL As String
SATURDAY_DEPART_TIME_INITAL = ActiveWorkbook.Sheets("SAT").Range("H8").Formula

If InStr(1, SATURDAY_DEPART_TIME_INITAL, "=IFERROR") Then
SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "=IFERROR(", "")
SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "", """ & """, "")
End If

SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "))", "), " & Chr(10) & "NAME=""" & Employee.Text & """,IF(ISBLANK(" & LResult & "_SATURDAY_DEPART_TIME_INITAL),""""," & LResult & "_SATURDAY_DEPART_TIME_INITAL)),""" & """")

With New MSForms.DataObject
.SetText SATURDAY_DEPART_TIME_INITAL
.PutInClipboard
End With

ActiveWorkbook.Sheets("SAT").Range("H8").FormulaLocal = "=IFERROR(" & SATURDAY_DEPART_TIME_INITAL & ")"

when i try to run the code it gives an error

errr.webp


any idea why its not working?
 
Last edited:
Back
Top