I have a macro with VBA, but my program fail. The Visual Basic Application show me this missatge : "Run-time error '438' Object doesn't support this property or method"
My code is :
Sub MACRO()
bAlerts = Application.DisplayAlerts
Application.DisplayAlerts = False
For i = 1 To Sheets.Count
***Sheets(i).Cells.Replace What:="C:\", Replacement:="C:\Gestion\"***
Next
Application.DisplayAlerts = bAlerts
End Sub
In the line Sheets(i).Cells.Replace What:="C:\", Replacement:="C:\Gestion\", my program doesn't work. What is the problem ?
My excel file it has the Microsoft Excel 97-2003 Format.
Finally, I could fix this.
My new code is :
Attribute VB_Name = "RemplazoString"
Sub MACRO()
Dim Sht As Worksheet
bAlerts = Application.DisplayAlerts
Application.DisplayAlerts = False
For Each Sht In Worksheets
Sht.Cells.Replace What:="C:\", Replacement:="C:\Gestion\", LookAt:=xlPart, MatchCase:=False
Next
Application.DisplayAlerts = bAlerts
End Sub
Thanks!
Chart
sheets? – Dmitry Pavliv