not able to print from line a4

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

The following code ends in print preview starting line 7 and not line 4. any
suggestions please. I changed A7 to A4 in the with statement and still the
same problem.


Sub Picture22_Click()

Dim c As Range
Application.ScreenUpdating = False
With ActiveSheet.Range("A7:A159")
Do
Set c = .Find("", LookIn:=xlValues, LookAt:=xlWhole, _
MatchCase:=False)
If c Is Nothing Then Exit Do
c.EntireRow.Hidden = True
Loop
.Range("A4:D160").PrintPreview
.EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub
 
This statement:

With ActiveSheet.Range("A7:A159")
....
.Range("A4:D160").PrintPreview

is the same as:

ActiveSheet.Range("A7:A159").Range("A4:D160").PrintPreview

Which points at A10:D166

You may want:

.parent.Range("A4:D160").PrintPreview
 
Hi,
Thanks


Dave Peterson said:
This statement:

With ActiveSheet.Range("A7:A159")
....
.Range("A4:D160").PrintPreview

is the same as:

ActiveSheet.Range("A7:A159").Range("A4:D160").PrintPreview

Which points at A10:D166

You may want:

.parent.Range("A4:D160").PrintPreview
 
Back
Top