LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default VBA - How to parcel a large selection to avoid XL Crash

2003

VBA code that I use works fine except for large files.

Part of the code, selects all formula cells then applies a border around a sub-set of those cells
limited by the application of a IF statement as follows:

Set MyRange = Selection.SpecialCells(xlFormulas, 23)
If Not IsError(MyRange.DirectPrecedents) Then
With MyRange.DirectPrecedents
.Borders(xlEdgeLeft).LineStyle = xlContinuous
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeLeft).ColorIndex = 4 ' Bright Green
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeTop).ColorIndex = 4 ' Bright Green
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeBottom).ColorIndex = 4 ' Bright Green
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeRight).ColorIndex = 4 ' Bright Green
.Borders(xlInsideVertical).LineStyle = xlContinuous
.Borders(xlInsideVertical).Weight = xlMedium
.Borders(xlInsideVertical).ColorIndex = 4 ' Bright Green
.Borders(xlInsideHorizontal).LineStyle = xlContinuous
.Borders(xlInsideHorizontal).Weight = xlMedium
.Borders(xlInsideHorizontal).ColorIndex = 4 ' Bright Green
End With

A problem occurs with large files where either the shear number of selected cells overwhelms Excel
and/or the processing involved in applying the borders to those causes Excel to crash.

My question, with VBA, how can I programmatically limit the number of cells (it might be that 8192
non-contiguous cell issue) to say groups of say 5000 cells per processing loop but at the same time
make sure that of all the desire cells are processed?

Thanks

EagleOne
 
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
Selection Too Large Martin Excel Discussion (Misc queries) 1 May 20th 06 02:26 PM
why does sorting large columns create errors in top selection? Mitch Excel Worksheet Functions 1 November 17th 05 08:19 PM
Getting error "selection is too large" when copying data Tootie Excel Discussion (Misc queries) 1 October 6th 05 12:19 AM
Getting error "selection is too large" when copying data Tootie Excel Discussion (Misc queries) 0 October 5th 05 08:42 PM
How do I copy a LARGE selection of cells from Excel to powerpoint? Deadly Excel Discussion (Misc queries) 2 August 15th 05 03:21 PM


All times are GMT +1. The time now is 03:38 PM.

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"