Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple VBA Code written in Excel 2003 not working in Excel 2000

Hi. I wrote some simple code in Excel 2003 (see below) to hide certain rows
if the user selects a certain option button. It works fine on Excel 2003,
but when the user tries it on his machine (he has Excel 2000), he gets a
run-time 1004 error message. From what he describes it sounds like the error
is ocurring somewhere after the "End With" line since when he clicks "End" on
the error message screen, he is taken to the "TrlInputs" sheet (the started
on the "GenInputs" sheet since that is where the option button is located).

Any help would be greatly appreciated!

Thanks.
Rich



Private Sub OptionButtonActual_Click()

Application.ScreenUpdating = False
Sheets("TrlInputs").Select

Sheets("TrlInputs").Unprotect Password:="password"
With Sheets("TrlInputs")
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
Sheets("TrlInputs").Range("A1").Select
Sheets("TrlInputs").Protect Password:="password", DrawingObjects:=True

Sheets("GenInputs").Select
Sheets("GenInputs").Range("H4").Select
Application.ScreenUpdating = True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Simple VBA Code written in Excel 2003 not working in Excel 2000

Use Worksheets instead of Sheets, or
First:
Dim wks as worksheet
Dim wks2 as worksheet
Second:

Set wks = WorkSheets("TrlInputs")
Set wks2 = WorkSheets("GenInputs")
Third:

Application.ScreenUpdating = False
wks.select

wks.Unprotect Password:="password"
With wks
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
wks.Range("A1").Select
wks.Protect Password:="password", DrawingObjects:=True

wks2.Select
wks2.Range("H4").Select
Application.ScreenUpdating = True

Michael Arch.




"Rich B." wrote:

Hi. I wrote some simple code in Excel 2003 (see below) to hide certain rows
if the user selects a certain option button. It works fine on Excel 2003,
but when the user tries it on his machine (he has Excel 2000), he gets a
run-time 1004 error message. From what he describes it sounds like the error
is ocurring somewhere after the "End With" line since when he clicks "End" on
the error message screen, he is taken to the "TrlInputs" sheet (the started
on the "GenInputs" sheet since that is where the option button is located).

Any help would be greatly appreciated!

Thanks.
Rich



Private Sub OptionButtonActual_Click()

Application.ScreenUpdating = False
Sheets("TrlInputs").Select

Sheets("TrlInputs").Unprotect Password:="password"
With Sheets("TrlInputs")
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
Sheets("TrlInputs").Range("A1").Select
Sheets("TrlInputs").Protect Password:="password", DrawingObjects:=True

Sheets("GenInputs").Select
Sheets("GenInputs").Range("H4").Select
Application.ScreenUpdating = True

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple VBA Code written in Excel 2003 not working in Excel 200

Thanks Michael for your help. I made the changes that you suggested,
explicitly declaring each of the worksheets as worksheets. I just sent the
file to the user so I'll let you know if it worked.

Do you think there could be a problem with the "DrawingObjects" part of the
protect method? I think that Excel 2003 has more options to proect a
worksheet than Excel 2000 does, and if so, perhaps this could be a problem as
well if it is not recognized in Excel 2000???

Thanks again!
Rich


"Michael" wrote:

Use Worksheets instead of Sheets, or
First:
Dim wks as worksheet
Dim wks2 as worksheet
Second:

Set wks = WorkSheets("TrlInputs")
Set wks2 = WorkSheets("GenInputs")
Third:

Application.ScreenUpdating = False
wks.select

wks.Unprotect Password:="password"
With wks
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
wks.Range("A1").Select
wks.Protect Password:="password", DrawingObjects:=True

wks2.Select
wks2.Range("H4").Select
Application.ScreenUpdating = True

Michael Arch.




"Rich B." wrote:

Hi. I wrote some simple code in Excel 2003 (see below) to hide certain rows
if the user selects a certain option button. It works fine on Excel 2003,
but when the user tries it on his machine (he has Excel 2000), he gets a
run-time 1004 error message. From what he describes it sounds like the error
is ocurring somewhere after the "End With" line since when he clicks "End" on
the error message screen, he is taken to the "TrlInputs" sheet (the started
on the "GenInputs" sheet since that is where the option button is located).

Any help would be greatly appreciated!

Thanks.
Rich



Private Sub OptionButtonActual_Click()

Application.ScreenUpdating = False
Sheets("TrlInputs").Select

Sheets("TrlInputs").Unprotect Password:="password"
With Sheets("TrlInputs")
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
Sheets("TrlInputs").Range("A1").Select
Sheets("TrlInputs").Protect Password:="password", DrawingObjects:=True

Sheets("GenInputs").Select
Sheets("GenInputs").Range("H4").Select
Application.ScreenUpdating = True

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Simple VBA Code written in Excel 2003 not working in Excel 200

Michael-
I just got word back that the changes you suggested work - no more run-time
error!

Thanks for your help!



"Rich B." wrote:

Thanks Michael for your help. I made the changes that you suggested,
explicitly declaring each of the worksheets as worksheets. I just sent the
file to the user so I'll let you know if it worked.

Do you think there could be a problem with the "DrawingObjects" part of the
protect method? I think that Excel 2003 has more options to proect a
worksheet than Excel 2000 does, and if so, perhaps this could be a problem as
well if it is not recognized in Excel 2000???

Thanks again!
Rich


"Michael" wrote:

Use Worksheets instead of Sheets, or
First:
Dim wks as worksheet
Dim wks2 as worksheet
Second:

Set wks = WorkSheets("TrlInputs")
Set wks2 = WorkSheets("GenInputs")
Third:

Application.ScreenUpdating = False
wks.select

wks.Unprotect Password:="password"
With wks
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
wks.Range("A1").Select
wks.Protect Password:="password", DrawingObjects:=True

wks2.Select
wks2.Range("H4").Select
Application.ScreenUpdating = True

Michael Arch.




"Rich B." wrote:

Hi. I wrote some simple code in Excel 2003 (see below) to hide certain rows
if the user selects a certain option button. It works fine on Excel 2003,
but when the user tries it on his machine (he has Excel 2000), he gets a
run-time 1004 error message. From what he describes it sounds like the error
is ocurring somewhere after the "End With" line since when he clicks "End" on
the error message screen, he is taken to the "TrlInputs" sheet (the started
on the "GenInputs" sheet since that is where the option button is located).

Any help would be greatly appreciated!

Thanks.
Rich



Private Sub OptionButtonActual_Click()

Application.ScreenUpdating = False
Sheets("TrlInputs").Select

Sheets("TrlInputs").Unprotect Password:="password"
With Sheets("TrlInputs")
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
Sheets("TrlInputs").Range("A1").Select
Sheets("TrlInputs").Protect Password:="password", DrawingObjects:=True

Sheets("GenInputs").Select
Sheets("GenInputs").Range("H4").Select
Application.ScreenUpdating = True

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Simple VBA Code written in Excel 2003 not working in Excel 2000

You're welcome

"Rich B." wrote:

Hi. I wrote some simple code in Excel 2003 (see below) to hide certain rows
if the user selects a certain option button. It works fine on Excel 2003,
but when the user tries it on his machine (he has Excel 2000), he gets a
run-time 1004 error message. From what he describes it sounds like the error
is ocurring somewhere after the "End With" line since when he clicks "End" on
the error message screen, he is taken to the "TrlInputs" sheet (the started
on the "GenInputs" sheet since that is where the option button is located).

Any help would be greatly appreciated!

Thanks.
Rich



Private Sub OptionButtonActual_Click()

Application.ScreenUpdating = False
Sheets("TrlInputs").Select

Sheets("TrlInputs").Unprotect Password:="password"
With Sheets("TrlInputs")
.Rows("12:13").EntireRow.Hidden = True
.Rows("21:54").EntireRow.Hidden = False
End With
Sheets("TrlInputs").Range("A1").Select
Sheets("TrlInputs").Protect Password:="password", DrawingObjects:=True

Sheets("GenInputs").Select
Sheets("GenInputs").Range("H4").Select
Application.ScreenUpdating = True

End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with VBA code written in Excel 2002 working in Office 2003 [email protected] Excel Programming 2 July 11th 06 08:44 PM
Excel 2003 won't run simple code that Excel XP and Excel 2000 will run Moses[_2_] Excel Programming 4 January 27th 05 06:30 AM
Excel 2003 wont recognize UDF written with 2000 Alan[_29_] Excel Programming 0 November 23rd 04 08:16 PM
Macro written in Excel 2003 and saved as Excel 2000 .xls Chip Pearson Excel Programming 0 September 2nd 04 03:30 AM
macro written in Excel 2000 not working in Excel 2002 Ivan H. Excel Programming 0 August 21st 03 11:33 PM


All times are GMT +1. The time now is 02:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"