+ Reply to Thread
Results 1 to 3 of 3

Run a macro when a user clicks in a certain cell

Hybrid View

  1. #1
    Registered User
    Join Date
    11-27-2006
    Posts
    9

    Run a macro when a user clicks in a certain cell

    I need to run a macro when a user clicks in a certain cell.
    e.g. When a user clicks in any cell, say any cell between cells c10 and c20, I would like to run a macro that I have already created.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    This macro works whenever cells C10 to C20 are selected. This could be by clicking, tabing etc

    'To install macro to correct location

    'Copy this macro
    'GoTo Excel
    'Select sheet this is to appy to
    'Right Click on Sheet Name Tab > select View Code
    'Past macro into the Worksheet Module displayed

    Change MyMacro as required

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
       If Not Application.Intersect(Target, Range("c10:c20")) Is Nothing Then
          Call Mymacro
       End If
    End Sub
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    11-27-2006
    Posts
    9

    thank you

    Thank you - that works great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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