View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey[_2_] JE McGimpsey[_2_] is offline
external usenet poster
 
Posts: 40
Default Macro print range

One way:

Public Sub PrintDtoJ()
Dim nLastRow As Long
Dim i As Long

nLastRow = 10
For i = 4 to 10
nLastRow = Application.Max(nLastRow, _
Cells(Rows.Count, i).End(xlUp).Row)
Next i
With ActiveSheet
.PageSetup.PrintArea = "D10:J" & nLastRow
.PrintOut
End With
End Sub


In article ,
"Shawn" wrote:

I have a spread sheet that I would like to print columns
D to J starting with row 10. The number of rows that
have information in them will be different every time. I
would only like to print the number of rows that have
data in them. Please help me with writting a macro to
preform this action. Thank you very much.