techmaster29729
New Member
- Joined
- Aug 4, 2017
- Messages
- 3
[FONT="]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[/FONT]
[FONT="]here's what i got[/FONT]
[FONT="]when i try to run the code it gives an error
[/FONT]
[FONT="]any idea why its not working?[/FONT]
[FONT="]here's what i got[/FONT]
Code:
[COLOR=#141414][FONT="]Dim SATURDAY_DEPART_TIME_INITAL As String[/FONT][/COLOR]
[COLOR=#141414][FONT="]SATURDAY_DEPART_TIME_INITAL = ActiveWorkbook.Sheets("SAT").Range("H8").Formula[/FONT][/COLOR]
[COLOR=#141414][FONT="]If InStr(1, SATURDAY_DEPART_TIME_INITAL, "=IFERROR") Then[/FONT][/COLOR]
[COLOR=#141414][FONT="]SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "=IFERROR(", "")[/FONT][/COLOR]
[COLOR=#141414][FONT="]SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "", """ & """, "")[/FONT][/COLOR]
[COLOR=#141414][FONT="]End If[/FONT][/COLOR]
[COLOR=#141414][FONT="]SATURDAY_DEPART_TIME_INITAL = Replace(SATURDAY_DEPART_TIME_INITAL, "))", "), " & Chr(10) & "NAME=""" & [/FONT][/COLOR][COLOR=#141414][FONT="]Employee.Text[/FONT][/COLOR][COLOR=#141414][FONT="] & """,IF(ISBLANK(" & LResult & "_SATURDAY_DEPART_TIME_INITAL),""""," & LResult & "_SATURDAY_DEPART_TIME_INITAL)),""" & """")[/FONT][/COLOR]
[COLOR=#141414][FONT="]With New MSForms.DataObject[/FONT][/COLOR]
[COLOR=#141414][FONT="].SetText SATURDAY_DEPART_TIME_INITAL[/FONT][/COLOR]
[COLOR=#141414][FONT="].PutInClipboard[/FONT][/COLOR]
[COLOR=#141414][FONT="]End With[/FONT][/COLOR]
[COLOR=#141414][FONT="]ActiveWorkbook.Sheets("SAT").Range("H8").FormulaLocal = "=IFERROR(" & SATURDAY_DEPART_TIME_INITAL & ")"[/FONT][/COLOR]
[FONT="]when i try to run the code it gives an error
[/FONT]
[FONT="]any idea why its not working?[/FONT]