+ Reply to Thread
Results 1 to 7 of 7

Assigning text in a cell to a macro

  1. #1
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Assigning text in a cell to a macro

    I have cell with some ordinary text.
    Is it possible to I assign that text (or the cell itself) to a macro? An hyperlink is not an option.
    Saturn

  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
    44,461

    Re: Assigning text in a cell to a macro

    What do you mean by assign the text in a cell to a macro?
    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


  3. #3
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Re: Assigning text in a cell to a macro

    By clicking the text I want to run the macro.
    There is noe problem with assigning a shape or an image to a macro, but text in a cell.....

  4. #4
    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
    44,461

    Re: Assigning text in a cell to a macro

    If you want to activate a macro by clicking on in a cell, you could use a Worksheet Selection Change event handler.

    For example:

    Please Login or Register  to view this content.

    Right click on the worksheet tab; select View code and copy and paste the code above into the empty page.

    When you click on a cell, it will display the address and the value.

    Regards, TMS

  5. #5
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Re: Assigning text in a cell to a macro

    Thanks for your answer TMS but I am in doubt how this procedure can help me with activating the macro in question .....

  6. #6
    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
    44,461

    Re: Assigning text in a cell to a macro

    What "macro in question"?

    Just replace the message box with a call to your macro. I don't know what the macro does or what input it needs as you have not shared that information.

    Regards, TMS

  7. #7
    Forum Contributor
    Join Date
    10-31-2006
    Location
    Oslo, Norway
    MS-Off Ver
    MS 365 Business
    Posts
    286

    Re: Assigning text in a cell to a macro

    I am still stuck. Enclosed is a workbook where I have two macros and they perform a very simple example task.
    I have placed your example above in both a separate module as well as in sheet1 in the VBEditor.
    I admit I am lack of basic VBA knowledge but could you modify the workbook so it will perform the task when pressing the cell, for an A and a B respectively ?
    Attached Files Attached Files

+ 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] assigning number to text in a cell then adding a range together in another cell
    By joe malik in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-12-2013, 01:12 AM
  2. Assigning Object a Macro to unhide hidden tabs with specific text
    By alorro3 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2012, 12:26 PM
  3. Assigning a value to text cell but value not to display!
    By cazzababes in forum Excel General
    Replies: 4
    Last Post: 05-15-2012, 04:37 PM
  4. assigning text to cell values
    By pani_hcu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-05-2011, 03:54 AM
  5. Excel 2007 : Assigning text to a cell value
    By Toomay in forum Excel General
    Replies: 2
    Last Post: 02-18-2010, 03:31 PM

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