#1   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Simple Macro


Please can somebody help - I would ask if anybody could write a simple
macro where the macro would constantly monitor a specific cell in a
worksheet called "Access" - say cell B9 or so.

If the cell matches either the following 3 then run "macro1"

Be: Empty
Be: 00:00:00:00:00:00
Be: 00-00-00-00-00-00

If the cell matches anything else then run "macro2"

I then could add macro1 or macro2 vba.

Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=541236

  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default Simple Macro

The following code should be pasted into worksheet's code
(right-click on sheet tab, select code)

'-----------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rWatch As Range
Set rWatch = Range("B9")
If Intersect(Target, rWatch) Is Nothing Then Exit Sub
Select Case rWatch.Value
Case "", _
"00:00:00:00:00:00", _
"00-00-00-00-00-00"
Call macro1
Case Else
Call macro2
End Select
End Sub

Sub macro1()
MsgBox "macro1"
End Sub

Sub macro2()
MsgBox "macro2"
End Sub
'-------------

"sparx" a écrit dans le
message de news: ...

Please can somebody help - I would ask if anybody could write a simple
macro where the macro would constantly monitor a specific cell in a
worksheet called "Access" - say cell B9 or so.

If the cell matches either the following 3 then run "macro1"

Be: Empty
Be: 00:00:00:00:00:00
Be: 00-00-00-00-00-00

If the cell matches anything else then run "macro2"

I then could add macro1 or macro2 vba.

Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile:
http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=541236



  #3   Report Post  
Posted to microsoft.public.excel.misc
Miguel Zapico
 
Posts: n/a
Default Simple Macro

You may use a code like this in the Worksheet_change event for the Access
worksheet.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$B$9" Then
If (Target.Value = "" Or Target.Value = "00:00:00:00:00:00" Or
Target.Value = "00-00-00-00-00-00") Then
' Run macro 1 here
Else
' Run macro 2 here
End If
End If
End Sub

Hope this helps,
Miguel.

"sparx" wrote:


Please can somebody help - I would ask if anybody could write a simple
macro where the macro would constantly monitor a specific cell in a
worksheet called "Access" - say cell B9 or so.

If the cell matches either the following 3 then run "macro1"

Be: Empty
Be: 00:00:00:00:00:00
Be: 00-00-00-00-00-00

If the cell matches anything else then run "macro2"

I then could add macro1 or macro2 vba.

Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=541236


  #4   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Simple Macro


Hi there, ive tried your vba but cant get anything to run! any
suggestions - if it runs on your pc, is there a chance you can attach
your excel file to a reply?


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=541236

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
Simple macro help chip_pyp Excel Discussion (Misc queries) 3 January 10th 06 07:57 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
Simple macro please sasha New Users to Excel 1 July 19th 05 12:51 PM
Recording simple macro Dave Excel Worksheet Functions 5 July 16th 05 12:34 AM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


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