ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Time Error 1004: Please help (https://www.excelbanter.com/excel-programming/353838-run-time-error-1004-please-help.html)

BEEJAY

Run Time Error 1004: Please help
 
Option Explicit

Private Sub REmove_Net_Pricing_Info_Click()

' SelectButton Macro
' Macro recorded 2/20/2006 by JFS
' Delete TP Contract References to Pricing (Customer Copy),
' so it can be added to Trailer Contract
'
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("Fern")
End If

Next
ActiveWorkbook.Unprotect (["Ferd"])

Sheets("Options").Select
Range("C6").Select
Selection.ClearContents
Range("H6:I6").Select
Selection.ClearContents

Sheets("Pricing").Select
Range("C120").Select
Selection.ClearContents
Range("C121").Select
Selection.ClearContents

Sheets("Contract").Select
Range("B1").Select

If ws.ProtectContents = False Then
ws.Protect ("Fern")
End If

Application.ScreenUpdating = True

End Sub



Tom Ogilvy

Run Time Error 1004: Please help
 
Option Explicit

Private Sub REmove_Net_Pricing_Info_Click()

' SelectButton Macro
' Macro recorded 2/20/2006 by JFS
' Delete TP Contract References to Pricing (Customer Copy),
' so it can be added to Trailer Contract
'
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("Fern")
End If

Next
ActiveWorkbook.Unprotect (["Ferd"])

Sheets("Options").Select
Range("C6").Select
Selection.ClearContents
Range("H6:I6").Select
Selection.ClearContents

Sheets("Pricing").Select
Range("C120").Select
Selection.ClearContents
Range("C121").Select
Selection.ClearContents

Sheets("Contract").Select
Range("B1").Select

for each ws in ActiveWorkbook.Worksheets
If ws.ProtectContents = False Then
ws.Protect ("Fern")
End If
Next
Application.ScreenUpdating = True

End Sub

--
Regards,
Tom Ogilvy


"BEEJAY" wrote in message
...
Option Explicit

Private Sub REmove_Net_Pricing_Info_Click()

' SelectButton Macro
' Macro recorded 2/20/2006 by JFS
' Delete TP Contract References to Pricing (Customer Copy),
' so it can be added to Trailer Contract
'
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("Fern")
End If

Next
ActiveWorkbook.Unprotect (["Ferd"])

Sheets("Options").Select
Range("C6").Select
Selection.ClearContents
Range("H6:I6").Select
Selection.ClearContents

Sheets("Pricing").Select
Range("C120").Select
Selection.ClearContents
Range("C121").Select
Selection.ClearContents

Sheets("Contract").Select
Range("B1").Select

If ws.ProtectContents = False Then
ws.Protect ("Fern")
End If

Application.ScreenUpdating = True

End Sub





BEEJAY

Run Time Error 1004: Please help
 
SORRY about the duplicate posting - please use other one - Thank you.


BEEJAY

Run Time Error 1004: Please help
 
Thanks, Tom, for the prompt response.
Sorry this one got sent before I completed my comments
- I hit the right button at the wrong time, I guess.

I added your input to that received from the other post and got it going.
Thanks Again.
jfs

"Tom Ogilvy" wrote:

Option Explicit

Private Sub REmove_Net_Pricing_Info_Click()

' SelectButton Macro
' Macro recorded 2/20/2006 by JFS
' Delete TP Contract References to Pricing (Customer Copy),
' so it can be added to Trailer Contract
'
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("Fern")
End If

Next
ActiveWorkbook.Unprotect (["Ferd"])

Sheets("Options").Select
Range("C6").Select
Selection.ClearContents
Range("H6:I6").Select
Selection.ClearContents

Sheets("Pricing").Select
Range("C120").Select
Selection.ClearContents
Range("C121").Select
Selection.ClearContents

Sheets("Contract").Select
Range("B1").Select

for each ws in ActiveWorkbook.Worksheets
If ws.ProtectContents = False Then
ws.Protect ("Fern")
End If
Next
Application.ScreenUpdating = True

End Sub

--
Regards,
Tom Ogilvy


"BEEJAY" wrote in message
...
Option Explicit

Private Sub REmove_Net_Pricing_Info_Click()

' SelectButton Macro
' Macro recorded 2/20/2006 by JFS
' Delete TP Contract References to Pricing (Customer Copy),
' so it can be added to Trailer Contract
'
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
If ws.ProtectContents = True Then
ws.Unprotect ("Fern")
End If

Next
ActiveWorkbook.Unprotect (["Ferd"])

Sheets("Options").Select
Range("C6").Select
Selection.ClearContents
Range("H6:I6").Select
Selection.ClearContents

Sheets("Pricing").Select
Range("C120").Select
Selection.ClearContents
Range("C121").Select
Selection.ClearContents

Sheets("Contract").Select
Range("B1").Select

If ws.ProtectContents = False Then
ws.Protect ("Fern")
End If

Application.ScreenUpdating = True

End Sub







All times are GMT +1. The time now is 05:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com