+ Reply to Thread
Results 1 to 6 of 6

Need to pass the active cell to a String Variable

  1. #1
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Need to pass the active cell to a String Variable

    I'm trying to select a cell, click a button (command button, P1 - Running in "Private Sub P1_Click()" ), and then use the active cell (before the button was clicked) in a String variable for another part of the code.

    Is this possible?
    What commands would I be looking to study to shed some light on this?
    Last edited by Darth269; 02-17-2014 at 06:38 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Need to pass the active cell to a String Variable

    Does this code help?
    Please Login or Register  to view this content.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Need to pass the active cell to a String Variable

    That's it, thank you Ron.

  4. #4
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Need to pass the active cell to a String Variable

    Quote Originally Posted by Ron Coderre View Post
    Does this code help?
    Please Login or Register  to view this content.
    Hi there People/Ron,

    The above code is SOOOOOO close, but this address it's assigning to the string has $ symbols with it, i.e. "$A$1", is there a way to set it as simply "A1"?

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Need to pass the active cell to a String Variable

    Here you go...try this:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-05-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    365
    Posts
    87

    Re: Need to pass the active cell to a String Variable

    Quote Originally Posted by Ron Coderre View Post
    Here you go...try this:
    Please Login or Register  to view this content.
    Man, you're awesome, thank you.

+ 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. Pass Cell Values in a Dynamic Range to String
    By Jimmy0306 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-06-2013, 01:54 PM
  2. Replies: 2
    Last Post: 10-21-2011, 04:13 AM
  3. Pass combo box value to string variable in module
    By magix in forum Excel General
    Replies: 1
    Last Post: 12-15-2005, 11:50 AM
  4. pass cell value as string to function
    By fybar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 12:40 AM
  5. Pass multiple characters to a string variable
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-19-2005, 06:26 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