not able to print from line a4

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
 
D

Dave Peterson

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
 
K

Khalil handal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top