I have recorded a macro and now it is giving me a runtime error 1004 "There's a problem with this formula" in connection with ExecuteExcel4Macro.
I have tried with double quotes without success
Can anyone point to an error in the code?
I have tried with double quotes without success
Code:
ExecuteExcel4Macro "(2,1,"""";;;@"""")"
Code:
Sub LinkPercent()
'Converts the linked values in Table_Word sheet back to percentages
'
Dim wbk As Workbook
Dim Filename As String
Dim Path As String
Path = "C:\xxx\ExcelFixPct\"
Filename = Dir(Path & "*.xlsx")
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Do While Len(Filename) > 0
Set wbk = Workbooks.Open(Path & Filename)
Sheets("Table_Word").Select
Range("B7").Select
ActiveCell.FormulaR1C1 = "=IF('User Form'!R[15]C="""","""",'User Form'!R[15]C)"
Selection.AutoFill Destination:=Range("B7:J7"), Type:=xlFillDefault
'Range("B7:J7").Select
Range("B7").Select
Selection.NumberFormat = ";;;@"
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=NOT(ISNUMBER('User Form'!B22))"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
ExecuteExcel4Macro "(2,1,"";;;@"")"
'ExecuteExcel4Macro "(2,1,"""";;;@"""")" '<--double quotes don't help
Selection.FormatConditions(1).StopIfTrue = False
Selection.AutoFill Destination:=Range("B7:J7"), Type:=xlFillDefault
Range("B7:J7").Select
Selection.NumberFormat = "0.00%"
wbk.Close savechanges:=True
Filename = Dir
Loop
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Last edited: