ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA project created in Excel 2003 doesn't run in Excel 2000 (https://www.excelbanter.com/excel-discussion-misc-queries/126230-vba-project-created-excel-2003-doesnt-run-excel-2000-a.html)

Rick_T

VBA project created in Excel 2003 doesn't run in Excel 2000
 
Here is my code, it works perfectly in Excel 2003

Private Sub Commandbutton1_Click()
If (Range("S9") = 0) Then
'Unprotect Form 99
Sheets("Form-99").Select
ActiveSheet.Unprotect 5121
'Copy Signature
Sheets("Data Entry").Select
ActiveSheet.Unprotect 5121
Worksheets("Data Entry").Range("N3").Copy
'Paste into Form 99
Sheets("Form-99").Select
ActiveSheet.Range("Q8").Select
ActiveSheet.Paste
ActiveSheet.Shapes("Signature").Select
Selection.Name = "SignatureQ8"
'Protect Form 99
Application.CutCopyMode = False
Selection.Locked = True
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
'Update Data Entry & Protect
Sheets("Data Entry").Select
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Data Entry").Range("S9") = 1: Range("T9") = "Signed!"
End If
End Sub

On machines running Excel 2000 I get an error "Run time error 1004"
"The cell or chart you are trying to change is protected and therefore read
only"

From the code I am unprotecting, doing my work and protecting again. It
works fine in 2003, any sugestions on what is happening with 2000? I even
tried saving the file in an earlier version of Excell but this didn't help.

--
Rick

Jim Cone

VBA project created in Excel 2003 doesn't run in Excel 2000
 
Rick,

The password should be a String not a numeric value.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Rick_T"
wrote in message
...
Here is my code, it works perfectly in Excel 2003

Private Sub Commandbutton1_Click()
If (Range("S9") = 0) Then
'Unprotect Form 99
Sheets("Form-99").Select
ActiveSheet.Unprotect 5121
'Copy Signature
Sheets("Data Entry").Select
ActiveSheet.Unprotect 5121
Worksheets("Data Entry").Range("N3").Copy
'Paste into Form 99
Sheets("Form-99").Select
ActiveSheet.Range("Q8").Select
ActiveSheet.Paste
ActiveSheet.Shapes("Signature").Select
Selection.Name = "SignatureQ8"
'Protect Form 99
Application.CutCopyMode = False
Selection.Locked = True
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
'Update Data Entry & Protect
Sheets("Data Entry").Select
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Data Entry").Range("S9") = 1: Range("T9") = "Signed!"
End If
End Sub

On machines running Excel 2000 I get an error "Run time error 1004"
"The cell or chart you are trying to change is protected and therefore read
only"

From the code I am unprotecting, doing my work and protecting again. It
works fine in 2003, any sugestions on what is happening with 2000? I even
tried saving the file in an earlier version of Excell but this didn't help.

--
Rick

Rick_T

VBA project created in Excel 2003 doesn't run in Excel 2000
 
By a string you mean for example aabb? I tried this and received an error.
--
Rick


"Jim Cone" wrote:

Rick,

The password should be a String not a numeric value.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Rick_T"
wrote in message
...
Here is my code, it works perfectly in Excel 2003

Private Sub Commandbutton1_Click()
If (Range("S9") = 0) Then
'Unprotect Form 99
Sheets("Form-99").Select
ActiveSheet.Unprotect 5121
'Copy Signature
Sheets("Data Entry").Select
ActiveSheet.Unprotect 5121
Worksheets("Data Entry").Range("N3").Copy
'Paste into Form 99
Sheets("Form-99").Select
ActiveSheet.Range("Q8").Select
ActiveSheet.Paste
ActiveSheet.Shapes("Signature").Select
Selection.Name = "SignatureQ8"
'Protect Form 99
Application.CutCopyMode = False
Selection.Locked = True
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
'Update Data Entry & Protect
Sheets("Data Entry").Select
ActiveSheet.Protect 5121, DrawingObjects:=True, Contents:=True,
Scenarios:=True
Worksheets("Data Entry").Range("S9") = 1: Range("T9") = "Signed!"
End If
End Sub

On machines running Excel 2000 I get an error "Run time error 1004"
"The cell or chart you are trying to change is protected and therefore read
only"

From the code I am unprotecting, doing my work and protecting again. It
works fine in 2003, any sugestions on what is happening with 2000? I even
tried saving the file in an earlier version of Excell but this didn't help.

--
Rick


Jim Cone

VBA project created in Excel 2003 doesn't run in Excel 2000
 
Rick,

Enclose the password within quote marks...
"5121" or "aabb"
-or-
A String variable would work...

Dim Mush as String
Mush = "LotsOfLuck"
ActiveSheet.Unprotect Mush

--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html





"Rick_T"
wrote in message
By a string you mean for example aabb? I tried this and received an error.
--
Rick


"Jim Cone" wrote:
Rick,
The password should be a String not a numeric value.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




All times are GMT +1. The time now is 11:50 PM.

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