Hi All,
I have this macro code where it has more than 2 if statements in it. When I run them it ignores the second If statements being valid even though it is not. The if statement highlighted in bold is being treated as if the Value in C63 =0 eventhough it is not... Is there a VBA guru who can help on this please?
Many thanks..
For Each myCell In myRng.Cells
With myCell
If IsEmpty(.Offset(0, -1)) Then
'if the row is not marked, do nothing
Else
.Offset(0, -1).ClearContents 'clear mark for the next time
For iCtr = LBound(myAddresses) To UBound(myAddresses)
FormWks.Range(myAddresses(iCtr)).Value _
= myCell.Offset(0, iCtr).Value
Next iCtr
Application.Calculate 'just in case
'after testing, change to Preview to False to Print
'FormWks.PrintOut Preview:=True
Sheets("FINAL STATEMENTS").Select
Range("A1:E132").Select
Range("A1").Activate
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.Zoom = 90
End With
Selection.PrintOut Copies:=1, Collate:=True
Range("A133:K190").Select
Range("A133").Activate
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Draft = False
.Zoom = 65
End With
Selection.PrintOut Copies:=1, Collate:=True
Sheets("LH STATEMENTS - THIS YEAR").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("BUDGET vs ACTUAL").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("APPENDIX - A").Select
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = False
End With
If Worksheets("WORKINGS").Range("C36", "C42", "C55").Value = 0 Then
ActiveWindow.SelectSheets.PrintOut Copies:=0, Collate:=False
' this is ommitting Appendix A when there is no repair costs
Else
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
If Worksheets("WORKINGS").Range("C63").Value = 0 Then
ActiveWindow.SelectSheets.PrintOut Copies:=0, Collate:=False
Else
' this is ommiting the Appendix B when there is no Snking Fund Value
Sheets("APPENDIX - B").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
I have this macro code where it has more than 2 if statements in it. When I run them it ignores the second If statements being valid even though it is not. The if statement highlighted in bold is being treated as if the Value in C63 =0 eventhough it is not... Is there a VBA guru who can help on this please?
Many thanks..
For Each myCell In myRng.Cells
With myCell
If IsEmpty(.Offset(0, -1)) Then
'if the row is not marked, do nothing
Else
.Offset(0, -1).ClearContents 'clear mark for the next time
For iCtr = LBound(myAddresses) To UBound(myAddresses)
FormWks.Range(myAddresses(iCtr)).Value _
= myCell.Offset(0, iCtr).Value
Next iCtr
Application.Calculate 'just in case
'after testing, change to Preview to False to Print
'FormWks.PrintOut Preview:=True
Sheets("FINAL STATEMENTS").Select
Range("A1:E132").Select
Range("A1").Activate
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.Zoom = 90
End With
Selection.PrintOut Copies:=1, Collate:=True
Range("A133:K190").Select
Range("A133").Activate
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.Draft = False
.Zoom = 65
End With
Selection.PrintOut Copies:=1, Collate:=True
Sheets("LH STATEMENTS - THIS YEAR").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("BUDGET vs ACTUAL").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("APPENDIX - A").Select
With ActiveSheet.PageSetup
.CenterHorizontally = True
.CenterVertically = False
End With
If Worksheets("WORKINGS").Range("C36", "C42", "C55").Value = 0 Then
ActiveWindow.SelectSheets.PrintOut Copies:=0, Collate:=False
' this is ommitting Appendix A when there is no repair costs
Else
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
If Worksheets("WORKINGS").Range("C63").Value = 0 Then
ActiveWindow.SelectSheets.PrintOut Copies:=0, Collate:=False
Else
' this is ommiting the Appendix B when there is no Snking Fund Value
Sheets("APPENDIX - B").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If