VinodKrishnappa
New Member
- Joined
- Aug 6, 2016
- Messages
- 31
I want to combine two macros which are as follows
I've following macro to print letters with a data available in data sheet...
Sub PrintForms()
Dim StartRow As Integer
Dim EndRow As Integer
Dim Msg As String
Dim i As Integer
Sheets("Form").Activate
StartRow = Range("StartRow")
EndRow = Range("EndRow")
If StartRow > EndRow Then
Msg = "ERROR" & vbCrLf & "The starting row must be less than the ending row!"
MsgBox Msg, vbCritical, APPNAME
End If
For i = StartRow To EndRow
Range("RowIndex") = i
If Range("Preview") Then
ActiveSheet.PrintPreview
Else
ActiveSheet.PrintOut
End If
Next i
End Sub
I have following macros to hide the entire rows if the value is 0 in a particular cell.
Sub Hide_Zeroed_Rows()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Intersect(ActiveSheet.UsedRange, Range("A1:A11"))
cell.EntireRow.Hidden = cell.Value = 0 And Not IsEmpty(cell)
Next cell
Application.ScreenUpdating = True
End Sub
now i want this Hide_Zeroed_Rows macro to be combined with Printforms macro
I want this both macros to be processed at once...
Can you please help me ion this....
I've following macro to print letters with a data available in data sheet...
Sub PrintForms()
Dim StartRow As Integer
Dim EndRow As Integer
Dim Msg As String
Dim i As Integer
Sheets("Form").Activate
StartRow = Range("StartRow")
EndRow = Range("EndRow")
If StartRow > EndRow Then
Msg = "ERROR" & vbCrLf & "The starting row must be less than the ending row!"
MsgBox Msg, vbCritical, APPNAME
End If
For i = StartRow To EndRow
Range("RowIndex") = i
If Range("Preview") Then
ActiveSheet.PrintPreview
Else
ActiveSheet.PrintOut
End If
Next i
End Sub
I have following macros to hide the entire rows if the value is 0 in a particular cell.
Sub Hide_Zeroed_Rows()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Intersect(ActiveSheet.UsedRange, Range("A1:A11"))
cell.EntireRow.Hidden = cell.Value = 0 And Not IsEmpty(cell)
Next cell
Application.ScreenUpdating = True
End Sub
now i want this Hide_Zeroed_Rows macro to be combined with Printforms macro
I want this both macros to be processed at once...
Can you please help me ion this....