LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Help with VBA

Hi, this works for one cell, but how do i use this for several hundred cells
independently of each other, ie monitor cells, it compares A to B, if A is
higher than B, it beeps, G1 flashes slowly, and copies A to B, input to A is
from a DDE link from another program, so if A then changes again, higher than
its previous value, the sequence starts again, so you end up with B being the
maximum value of the time period that i monitored the event or if a certain
value is reached i can have a message appear in B1 to alert me to do
somthing, but although it works for one cell, i wish to compare,

A1 B1
A2 B2
A3 B3 and so on, do i have to change it from, Private Sub
Worksheet_Calculate() to something else to asighn it to each set of cells ?
or copy this dozens of times but change the Private Sub
Worksheet_Calculate(). im completely lost as to how to do it.

Thanks for any help.

Private Sub Worksheet_Calculate()
If Range("A1") Range("B1") Then
Beep
Range("A1").Copy
If Range("A1") Range("B1") Then Range("B1").PasteSpecial
Paste:=xlPasteValues
Dim newColor As Integer
Dim myCell As Range
Dim x As Integer
Dim fSpeed
Set myCell = Range("G1")
newColor = 42
fSpeed = 0.4
Do Until x = 10
DoEvents
Start = Timer
Delay = Start + fSpeed
Do Until Timer Delay
DoEvents
myCell.Interior.ColorIndex = newColor
Loop
Start = Timer
Delay = Start + fSpeed
Do Until Timer Delay
DoEvents
myCell.Interior.ColorIndex = xlNone
Loop
x = x + 1
Loop
End If
End Sub
 
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



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

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"