PDA

View Full Version : Excel 97 & 2000 Compatibility??



Hankins
04-27-2007, 07:40 AM
I have the following macro that I've composed in Excel 2000. When I transfer it to Excel 97 I get the error message below.

Macro:

Sub Pipe_Order()
'HIDE ROWS THAT ARE BLANK
BeginRow = 11
EndRow = 300
CHKCOL = 4
For ROWCNT = BeginRow To EndRow
If Cells(ROWCNT, CHKCOL).Value = "" Then
Cells(ROWCNT, CHKCOL).EntireRow.Hidden = True
End If
Next ROWCNT
End Sub

Error Message: Runtime Error 1004, Unable to set the Hidden property of the range class.

Any ideas?

lucas
04-27-2007, 11:31 AM
I don't have 97 right now but it looks like it's not sure which sheet to work with....try a with statment that includes the sheet..

with Worksheets("Sheet1")
or

With activeworksheet

don't forget the end with

You also need to use Option explicit and dim your variables. That might help you sort it out.

johnske
04-27-2007, 03:15 PM
I don't have 97 right now but it looks like it's not sure which sheet to work with....try a with statment that includes the sheet..

with Worksheets("Sheet1")
or

With activeworksheet

don't forget the end with

You also need to use Option explicit and dim your variables. That might help you sort it out.As Steve said... try
Option Explicit

Sub Pipe_Order()

Dim ROWCNT As Long
Const BeginRow As Long = 11
Const EndRow As Long = 300
Const CHKCOL As Long = 4

With ActiveSheet
'HIDE ROWS THAT ARE BLANK
For ROWCNT = BeginRow To EndRow
If .Cells(ROWCNT, CHKCOL).Value = "" Then
.Cells(ROWCNT, CHKCOL).EntireRow.Hidden = True
End If
Next ROWCNT
End With
End Sub