I have an Excel archive that contains about 100 sheets i want write VBA macro so that cell A1 of each sheet will contain this formula:
=RECHERCHEV(B2;'SUMUP'!B$1:H478;3;FAUX)
This is my macro
Sub WorksheetLoop()
' Declare Current as a worksheet object variable.
Dim Current As Worksheet
' Loop through all of the worksheets in the active workbook.
For Each Current In Worksheets
'Change the formula of cell A1
Current.Range("A1").Formula ="=RECHERCHEV(B2;'SUMUP'!B$1:H478;3;FAUX)"
Next
End Sub
When i execute this macro i got error of execution '1004', Note that SUMUP is a sheet of my archive
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…