ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Print routine needed for code (https://www.excelbanter.com/excel-worksheet-functions/130205-print-routine-needed-code.html)

pano

Print routine needed for code
 

Hi I hope someone can help me with this I want to run this on a sheet
carlog before printing but I cant work out how to put the print
routine in, anyone!!!!

Sub HideRows()
Dim i As Long
Application.ScreenUpdating = False
For i = 10 To 44
For j = 10 To 44
If Range("A" & i).Value = "" Then
Range("A" & i).EntireRow.Hidden = True
End If
If Range("b" & j).Value = 0 Then
Range("b" & j).EntireRow.Hidden = True
End If
Next 'i
Next 'j

Application.ScreenUpdating = True

End Sub


Mike

Print routine needed for code
 
If the macro does what you want then put it in the 'Before print, event.

Double click this workbook in VB editor. Select workbook from the dropdown
and then 'before print' from the other dropdown and paste your code in.

Mike

"pano" wrote:


Hi I hope someone can help me with this I want to run this on a sheet
carlog before printing but I cant work out how to put the print
routine in, anyone!!!!

Sub HideRows()
Dim i As Long
Application.ScreenUpdating = False
For i = 10 To 44
For j = 10 To 44
If Range("A" & i).Value = "" Then
Range("A" & i).EntireRow.Hidden = True
End If
If Range("b" & j).Value = 0 Then
Range("b" & j).EntireRow.Hidden = True
End If
Next 'i
Next 'j

Application.ScreenUpdating = True

End Sub



pano

Print routine needed for code
 
On Feb 11, 9:57 pm, Mike wrote:
If the macro does what you want then put it in the 'Before print, event.

Double click this workbook in VB editor. Select workbook from the dropdown
and then 'before print' from the other dropdown and paste your code in.

Mike



"pano" wrote:

Hi I hope someone can help me with this I want to run this on a sheet
carlog before printing but I cant work out how to put the print
routine in, anyone!!!!


Sub HideRows()
Dim i As Long
Application.ScreenUpdating = False
For i = 10 To 44
For j = 10 To 44
If Range("A" & i).Value = "" Then
Range("A" & i).EntireRow.Hidden = True
End If
If Range("b" & j).Value = 0 Then
Range("b" & j).EntireRow.Hidden = True
End If
Next 'i
Next 'j


Application.ScreenUpdating = True


End Sub- Hide quoted text -


- Show quoted text -


Thanks for that


Don Guillett

Print routine needed for code
 
See my ans in your OTHER POST. Pls do NOT do that.

--
Don Guillett
SalesAid Software

"pano" wrote in message
ps.com...
On Feb 11, 9:57 pm, Mike wrote:
If the macro does what you want then put it in the 'Before print, event.

Double click this workbook in VB editor. Select workbook from the
dropdown
and then 'before print' from the other dropdown and paste your code in.

Mike



"pano" wrote:

Hi I hope someone can help me with this I want to run this on a sheet
carlog before printing but I cant work out how to put the print
routine in, anyone!!!!


Sub HideRows()
Dim i As Long
Application.ScreenUpdating = False
For i = 10 To 44
For j = 10 To 44
If Range("A" & i).Value = "" Then
Range("A" & i).EntireRow.Hidden = True
End If
If Range("b" & j).Value = 0 Then
Range("b" & j).EntireRow.Hidden = True
End If
Next 'i
Next 'j


Application.ScreenUpdating = True


End Sub- Hide quoted text -


- Show quoted text -


Thanks for that





All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com