My workbook contains many sheets and before closing the workbook I would like to replace the same cell on all worksheets with the same text. For example, certain cells replace all that start with "rateid_???". I have tried the following code but receive an error on the IF ws.Range…… row. Could someone help me with the syntax?
Private Sub Workbook_BeforeClose(Cancel As Boolean) Result = MsgBox("Your file will be reset and INPUT HERE will replace all header fields !!!", vbOKCancel + vbCritical) If Result = vbOK Then Dim ws As Worksheet For Each ws In Worksheets If ws.Range.Cells.Value Like "rateid*" Then cell.Value = "INPUT HERE" If ws.Range.Cells.Value Like "po*" Then cell.Value = "INPUT HERE" '=== FYI ===I will need to add about 8 more rows to replace with IMPUT HERE code Next ws Else: End If End Sub