+ Reply to Thread
Results 1 to 3 of 3

Changing variables within the code with a button?

  1. #1
    Registered User
    Join Date
    10-23-2008
    Location
    Sweden
    Posts
    92

    Changing variables within the code with a button?

    Hello,

    I'm really not very good at programming so I have a question that I hope someone with greater knowledge might be able to answer.
    Is it possible to change the values of variables that are set in a subroutine with another subroutine?

    I have a subroutine called twometerspf that contain the following values:
    difference1 = "1.93"
    difference2 = "1.94"
    difference3 = "1.95"
    difference4 = "1.96"
    difference5 = "1.97"

    What I want to do is to be able to change these values with a click of a button in the worksheet.

    For example writing 1.63, 1.64, 1.65, 1.66 and 1.67 in specific cells and clicking the button would cause the variables to change to the below.
    difference1 = "1.63"
    difference2 = "1.64"
    difference3 = "1.65"
    difference4 = "1.66"
    difference5 = "1.67"

    If possible I'd also like to save these new values when saving the workbook, IE overwriting the original values in the subroutine. Is this possible?

    Regards
    /Johan

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,483

    Re: Changing variables within the code with a button?

    Make the variables = a cell
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-23-2008
    Location
    Sweden
    Posts
    92

    Re: Changing variables within the code with a button?

    Thanks, I'll try that :-)

+ 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] VBA Changing button.caption with the same Button.Name
    By mcmunoz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-27-2013, 04:58 AM
  2. Using Same Code, but changing the variables..
    By IveGotNoSocksOn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-07-2012, 08:31 PM
  3. multiple ifs with changing variables.
    By kristinejaekim in forum Excel General
    Replies: 3
    Last Post: 10-10-2012, 02:03 AM
  4. Excel 2007 : Iteration with 2 changing variables
    By DamirDz in forum Excel General
    Replies: 5
    Last Post: 08-24-2011, 06:20 PM
  5. Changing command button colors using variables
    By solnajeff in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2010, 11:26 AM
  6. Changing variables
    By Maxjacobs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2009, 02:40 AM
  7. Unzip Code - Works without Variables, Breaks with Variables...
    By AdamParker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-06-2009, 02:35 PM
  8. changing variables?
    By Larry Sartoris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-21-2005, 04:05 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