+ Reply to Thread
Results 1 to 2 of 2

Calling Macro from cell selection

  1. #1
    Registered User
    Join Date
    07-31-2014
    Location
    Israel
    MS-Off Ver
    7
    Posts
    4

    Calling Macro from cell selection

    Hi,

    I'm having problem with when trying to call Macros from cell selection/value.
    attached test sheet for reference.

    The code i'm using :

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address(True, True) = "$J$7" Then
    Select Case Target
    Case "SRG PER W/M"
    Call ADDSRGWMLINE
    Case "SRG PER TON OR PART OF IT"
    Call ADDLOCALPERTON
    Case Else
    'Do nothing
    End Select

    End If
    End Sub



    Thank you very much.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,167

    Re: Calling Macro from cell selection

    The cell content does not match what you are testing for in the code. It has more spaces: "SRG PER W/M" as opposed to

    Please Login or Register  to view this content.

    And do you actually mean Selection Change or Change. There is a difference.

    You also need to switch off event handling when you are going to change things within a Change Handler or select things in a Selection Change Handler.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] calling a macro on cell change
    By deek in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-07-2014, 04:17 PM
  2. VBA on calling a Macro via a specfic cell value
    By gpeacock1981 in forum Excel General
    Replies: 0
    Last Post: 12-07-2010, 11:44 AM
  3. Calling a Macro from a cell
    By sach0025 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-10-2007, 03:42 PM
  4. Replies: 2
    Last Post: 08-29-2006, 04:42 AM
  5. Calling macro on cell change
    By schoujar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-26-2005, 03:57 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