Results 1 to 7 of 7

Auto call macro without pressing button

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-12-2012
    Location
    India, Chennai
    MS-Off Ver
    Excel 2003
    Posts
    182

    Auto call macro without pressing button

    Dear Experts

    Please help!!!

    I need to auto call macro without pressing button.
    example If user enters time in cell range("M4:M200")
    P4:P200 (=IF(M4="","",1)
    If P4:P200 "1" Call add_timepunch (macro)

    I have this below code
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address = "$C$1" Then
        Set JR = Sheets("Jobs Record")
        Set DTE = Sheets("DailyTaskEntry")
        Set TP = Sheets("TimePunch")
      
    'Clear Current Data
        Call Clearit
    'See If Date is in Jobs record
        Dim JobFound As Range
        Set JR = Sheets("Jobs Record")
        D = Target.Value
        Set JobFound = JR.Columns(1).Find(Target.Value)
        If Not JobFound Is Nothing Then
        'If it is in the jobs record then retrieve existing data
            Call Retrieve(D)
            'If it is in the jobs record then retrieve existing data
            Call RetrieveTimePunch(D)
    
    'Brings save changes button to front
            ActiveSheet.Shapes("Button 3").ZOrder msoBringToFront
        Else
    'Brings Add button to front
        Call Clearit
            ActiveSheet.Shapes("Button 1").ZOrder msoBringToFront
        End If
    End If
    
    If Target.Column = 3 And Target.Row >= 4 And Target.Row <= 200 Then
        Call Colourc
    End If
     ' NOT WORKING 
    If Not Application.Intersect(Target, Range("P4:P200")) Is Nothing Then
                 Call add_timepunch
    End If
    
    End Sub
    Last edited by skhari; 06-17-2015 at 12:44 PM. Reason: Code tag added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. show area when pressing macro button
    By ossa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2012, 09:19 AM
  2. Macro to create form by pressing button
    By nani_nisha06 in forum Access Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2012, 02:55 PM
  3. [SOLVED] Macro to create form by pressing button
    By jesika in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2012, 02:35 PM
  4. Command button auto select after pressing Enter
    By Bafa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2006, 03:05 AM
  5. [SOLVED] Pressing a button using a macro
    By Todd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2005, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1