Flickering edit bar during loop
I have a loop that polls cells for format details, works
fine. However, if I have a worksheet object selected, the
edit bar flickers with the contents of the active cell
(that was active before selecting the object).
For demonstration:
Create a large used range, with cell entries in say A1
and K800
Select a cell entry, then an object
Sub Test()
Dim r As Range, ur As Range
Dim j As Variant 'normally a long for formats
Set ur = ActiveSheet.UsedRange
For Each r In ur
'edit bar flickers with previous active cell contents
j = r.Interior.ColorIndex
'comment j = format, un-comment j = value
'and edit bar does not flicker
'j = r.Value
Next
End Sub
Disabling screenupdating prevents the flicker and speeds
up the loop, a bit. But still significantly slower than if
a cell is selected. If a chart is selected as an active
chart (rather than merely as a chart object) the flicker
does not occur, but speed is also reduced.
Edit bar flicker only occurs if polling for cell format
attributes, of cells on the same sheet as the selected
object.
I get same results in XL97 & XL2K. I'm perplexed!
Any ideas how to avoid this flicker much appreciated, if
possible without disabling screenupdating or deselecting
the object.
TIA
Sandy
savituk yahoo co uk
|