Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Top Spin
 
Posts: n/a
Default Macro suddenly causes the screen to blink

On Thu, 25 Nov 2004 10:43:14 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Top

Application.ScreenUpdating = False

'your code that moves things

Application.ScreenUpdating = True


That made a huge difference -- thanks.

Also note that "selecting" things(which causes the flashing around)is usually
not necessary.

Range(Range("A1"), Range("A1").End(xlDown)).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.Paste

is equal to.....

Range(Range("A1"), Range("A1").End(xlDown)).Copy _
Destination:=Sheets("Sheet2").Range("A1")

and will not cause flashing because no ranges or sheets are actually selected.


I don't understand this syntax and cannot find it in the help. Is this
a command? a property? ???

What is the ":=" syntax? Is it documented anywhere?

Here is a snippet of code. It's a loop to reset the color and bold
attributes of a bunch of cells and to examine the values. Is there a
way to do this without selecting the cells?

Thanks



For iRow = iRowPC1 To iRowPC2 'Loop through all cells
Range(sColTlyLet & iRow).Select 'Position at next tally cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
End With
Range(sColSumLet & iRow).Select 'Position at next sum cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
nSum(iRow) = .Value 'Save the value for comparison
End With
Range(sColPCDLet & iRow).Select 'Position at % next cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
nPCD(iRow) = .Value 'Save the value for comparison
Next iRow


--
Email: Usenet-20031220 at spamex.com
(11/09/04)
  #2   Report Post  
Don Guillett
 
Posts: n/a
Default

why not try just
with range(yourrange).font
..ColorIndex = 0
..Bold = False
End With



--
Don Guillett
SalesAid Software

"Top Spin" wrote in message
...
On Thu, 25 Nov 2004 10:43:14 -0800, Gord Dibben <gorddibbATshawDOTca
wrote:

Top

Application.ScreenUpdating = False

'your code that moves things

Application.ScreenUpdating = True


That made a huge difference -- thanks.

Also note that "selecting" things(which causes the flashing around)is

usually
not necessary.

Range(Range("A1"), Range("A1").End(xlDown)).Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").Select
Selection.Paste

is equal to.....

Range(Range("A1"), Range("A1").End(xlDown)).Copy _
Destination:=Sheets("Sheet2").Range("A1")

and will not cause flashing because no ranges or sheets are actually

selected.

I don't understand this syntax and cannot find it in the help. Is this
a command? a property? ???

What is the ":=" syntax? Is it documented anywhere?

Here is a snippet of code. It's a loop to reset the color and bold
attributes of a bunch of cells and to examine the values. Is there a
way to do this without selecting the cells?

Thanks



For iRow = iRowPC1 To iRowPC2 'Loop through all cells
Range(sColTlyLet & iRow).Select 'Position at next tally cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
End With
Range(sColSumLet & iRow).Select 'Position at next sum cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
nSum(iRow) = .Value 'Save the value for comparison
End With
Range(sColPCDLet & iRow).Select 'Position at % next cell
With ActiveCell
.Font.ColorIndex = iColorAuto 'Reset it to black
.Font.Bold = False '.& make it unbold
nPCD(iRow) = .Value 'Save the value for comparison
Next iRow


--
Email: Usenet-20031220 at spamex.com
(11/09/04)



  #3   Report Post  
Top Spin
 
Posts: n/a
Default

On Sun, 28 Nov 2004 11:52:05 -0600, "Don Guillett"
wrote:

why not try just
with range(yourrange).font
.ColorIndex = 0
.Bold = False
End With


I'll try that. My code was obtained by modifying code from recording a
macro.

And "yourrange" can be any rectangular range, right?

That will work for resetting all of the cells to the same value, but I
also need to examine each cell value. Actually, store it in an array.
Is there a way to store an entire range (column) in consecutive
elements of an array with a single statement?

Thanks

--
Email: Usenet-20031220 at spamex.com
(11/09/04)
  #4   Report Post  
Top Spin
 
Posts: n/a
Default

On Sun, 28 Nov 2004 11:52:05 -0600, "Don Guillett"
wrote:

why not try just
with range(yourrange).font
.ColorIndex = 0
.Bold = False
End With


Thanks to everyone for the help. The macro now works almost
instantaneously. Even if I leave screen updating on, it only takes a
fraction of the time it used to take. Sweet!

Is there a way to assign the values in a range of cells to an array in
a single statement? If that is possible, I could eliminate all loops.

Thanks

--
Email: Usenet-20031220 at spamex.com
(11/09/04)
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
Macro does not run when data refreshed Larry Lehman Excel Discussion (Misc queries) 0 January 16th 05 07:31 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 3 December 13th 04 08:43 PM
Record Macro Relative does not work? lbbss Excel Discussion (Misc queries) 1 December 13th 04 07:55 PM
excel macro inconsistency JM Excel Discussion (Misc queries) 2 December 9th 04 01:13 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 04:51 PM.

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

About Us

"It's about Microsoft Excel"