centprop
New Member
- Joined
- Oct 14, 2010
- Messages
- 15
Hi,
I have a very clever workbook that creates reports for me. I didn't design this book, and am not all that experienced with VBA.
When it creates this report it hides unused lines to create the print layout.
I copied an existing sheet, to amend it to add a couple of new columns. This new sheet I have got to expand the sheet, but cant then hide any blank rows.
Existing code looks like this:
I duplicated the code, and made changes to the names of the named selections so that they would match the new named selections (sorry - I don't know the official term for the named selections - this is what you see in the name manager). So now the amended code for the new sheet looks like this:
It almost works as expected, with one exception. It no longer hides the unused rows.
Can anyone see why and give me some help to fix it please?
Thanks in advance
Chris
I have a very clever workbook that creates reports for me. I didn't design this book, and am not all that experienced with VBA.
When it creates this report it hides unused lines to create the print layout.
I copied an existing sheet, to amend it to add a couple of new columns. This new sheet I have got to expand the sheet, but cant then hide any blank rows.
Existing code looks like this:
Code:
Sub PortfolioUndatedGaps()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
PortfolioUndatedGapsOpen
PortfolioUndatedGapsClose
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub PortfolioUndatedGapsOpen()
Application.ScreenUpdating = False
Sheets("VacHoldingOSRR").Activate
Range("UndatedEventCount").Offset(3, 1).Select
Range(ActiveCell, ActiveCell.Offset(100, 0)).Select
Selection.Rows.Hidden = False
Range("A1").Select
End Sub
Sub PortfolioUndatedGapsClose()
Dim OffsetClose As Integer
Application.ScreenUpdating = False
OffsetClose = Range("UndatedEventCount").Value
Range("UndatedEventCount").Offset(4, 1).Select
If OffsetClose <> 0 Then
ActiveCell.Offset(OffsetClose - 1, 0).Select
End If
Range(ActiveCell, ActiveCell.Offset(100 - OffsetClose - 1, 0)).Select
Selection.Rows.Hidden = True
Range("A1").Select
End Sub
I duplicated the code, and made changes to the names of the named selections so that they would match the new named selections (sorry - I don't know the official term for the named selections - this is what you see in the name manager). So now the amended code for the new sheet looks like this:
Code:
Sub PortfolioUndatedGaps2()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
PortfolioUndatedGapsOpen2
PortfolioUndatedGapsClose2
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub PortfolioUndatedGapsOpen2()
Application.ScreenUpdating = False
Sheets("VacDocNeg").Activate
Range("UndatedEventCountvdn").Offset(3, 1).Select
Range(ActiveCell, ActiveCell.Offset(100, 0)).Select
Selection.Rows.Hidden = False
Range("A1").Select
End Sub
Sub PortfolioUndatedGapsClose2()
Dim OffsetClose As Integer
Application.ScreenUpdating = False
OffsetClose = Range("UndatedEventCountvdn").Value
Range("UndatedEventCountvdn").Offset(4, 1).Select
If OffsetClose2 <> 0 Then
ActiveCell.Offset(OffsetClose - 1, 0).Select
End If
Range(ActiveCell, ActiveCell.Offset(100 - OffsetClose - 1, 0)).Select
Selection.Rows.Hidden = True
Range("A1").Select
End Sub
It almost works as expected, with one exception. It no longer hides the unused rows.
Can anyone see why and give me some help to fix it please?
Thanks in advance
Chris