LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Frazer
 
Posts: n/a
Default Any errors in this?

Ok ive got some macro code here, wondering if anyone could help me find any
errors, because i cant:

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Address = "$AA$10" Then
If .Value = "1" Then
StartTimer
End If
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

Public RunWhen As Double
Public Const cRunIntervalSeconds = 30
Public Const cRunWhat = "Start2"
Sub StartTimer()

RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub Start2()

Range("Z11").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z12").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z13").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z14").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z15").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z16").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z17").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("Z18").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]=RC[-12], 2, 0)+1"
Range("AA18").Select
ActiveCell.FormulaR1C1 = "=1"
End Sub


Basically what it does it wait until i put a 1 in a cell, then starts a
timer for 30 seconds, which then adds a load of 1s to other cells.....

i know the coding for the timer and sub start2 are ok on their own, so i
dont think there is a problem there, it is only the top part i think where it
specifies to carry out the macro if the cell value of AA10 changes to 1...


can anyone spot anything ive done wrong?
 
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
REF errors when opening excel in xp. works fine when opening wor. br Excel Discussion (Misc queries) 6 September 13th 05 11:41 AM
Subtotal excl errors Rob Excel Worksheet Functions 2 May 2nd 05 02:49 PM
conditional forming causing linking errors Dave Breitenbach Excel Worksheet Functions 0 April 1st 05 08:19 PM
Errors accessing shared speadsheet. Gary H Excel Discussion (Misc queries) 0 February 7th 05 05:11 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


All times are GMT +1. The time now is 11:42 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"