Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Excel 2003: VBA - Hide Rows process now too slow

Have used the following for a number years (Thanks to Frank Kabel)
However, as the pricing sheets get larger (now about 1500 lines), it is
taking too long from start to finish. This particular process takes about 1
full minute.
The area of concern in the coding shown is between the
Any ideas/suggestions would be greatly appreciated

Sub PrintPricingCustomer()
' PrintPricingCustomer Macro
' Keyboard Shortcut: NONE
Worksheets("Pricing").Select
Call WS_Unprotect
Application.ScreenUpdating = False
Cells.Select
With Selection
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlNone
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Interior.ColorIndex = -4142
End With
With ActiveSheet.PageSetup
.PrintGridlines = False
.CenterHorizontally = True
End With
Cells.Select
With Selection
.EntireRow.Hidden = False
.EntireColumn.Hidden = False
End With

Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "B").Value = "x" Then
Rows(RowNdx).Hidden = True
End If
Next RowNdx


Columns("F:G").Select
Selection.EntireColumn.Hidden = True
Worksheets("Pricing").PrintOut Copies:=1, Collate:=True

Call Green
Call WS_Protect
Application.ScreenUpdating = True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Excel 2003: VBA - Hide Rows process now too slow

If you turn off the page break lines
tools|options|view tab|uncheck page breaks (in xl2003)

Does the code work faster?

When you're hiding rows/columns, excel wants to figure out where to draw those
lines each time you change the layout.

Turning of calculation and making sure you're in Normal view will help, too.

Option Explicit
Sub testme()

Dim CalcMode As Long
Dim ViewMode As Long

Application.ScreenUpdating = False

CalcMode = Application.Calculation
Application.Calculation = xlCalculationManual

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

'your code here

'put things back to what they were
Application.Calculation = CalcMode
ActiveWindow.View = ViewMode
Application.ScreenUpdating = True

End Sub

BEEJAY wrote:

Have used the following for a number years (Thanks to Frank Kabel)
However, as the pricing sheets get larger (now about 1500 lines), it is
taking too long from start to finish. This particular process takes about 1
full minute.
The area of concern in the coding shown is between the
Any ideas/suggestions would be greatly appreciated

Sub PrintPricingCustomer()
' PrintPricingCustomer Macro
' Keyboard Shortcut: NONE
Worksheets("Pricing").Select
Call WS_Unprotect
Application.ScreenUpdating = False
Cells.Select
With Selection
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).LineStyle = xlNone
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
.Borders(xlEdgeRight).LineStyle = xlNone
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Interior.ColorIndex = -4142
End With
With ActiveSheet.PageSetup
.PrintGridlines = False
.CenterHorizontally = True
End With
Cells.Select
With Selection
.EntireRow.Hidden = False
.EntireColumn.Hidden = False
End With

Dim RowNdx As Long
Dim LastRow As Long
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "B").Value = "x" Then
Rows(RowNdx).Hidden = True
End If
Next RowNdx


Columns("F:G").Select
Selection.EntireColumn.Hidden = True
Worksheets("Pricing").PrintOut Copies:=1, Collate:=True

Call Green
Call WS_Protect
Application.ScreenUpdating = True
End Sub


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Borders slowing filter process in Excel 2003 Denz Excel Discussion (Misc queries) 1 September 4th 08 11:23 PM
Hide empty rows in pivot table Excel 2003 menda Excel Discussion (Misc queries) 2 February 20th 08 12:16 PM
Hide data in specific rows/colums/cells in Excel 2003 Ben Excel Discussion (Misc queries) 3 October 21st 07 04:33 PM
Slow Running Code to Hide Blank Rows Aaron Excel Programming 3 January 10th 07 03:17 AM
Simplify Process with Excel 2003 Zraxius New Users to Excel 1 December 5th 04 01:55 PM


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"