+ Reply to Thread
Results 1 to 9 of 9

How do i avoid having to rewrite the code everytime a new variable is added to the sheet

  1. #1
    Registered User
    Join Date
    10-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Exclamation How do i avoid having to rewrite the code everytime a new variable is added to the sheet

    SAMPLE(1).xlsm

    Is there a way to avoid having to rewrite the code everytime a new variable is input to the spreadsheet? With the example attached, it would be "GHI".

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    can you explain better ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    SAMPLE(1).xlsm

    Attached is a spreadsheet with a macro written in the background. Basically, the macro says to populate a column accordding to specific conditions in the spreadsheet. Do you see where at the bottom of the data there is a little chart with ABC, DEF...those are just examples...what I am going to have is a bunch of different labeled variables in those columns ...in order to reference each variable..i have been going back and writing a code for each one to do what i want... I was wondering if there is another way to do it because rewriting the code...
    For ex. if i want to include GHI now...is there a macro to automatically pick up on the new variable?
    In the attachment: In yellow is the newly added row of data with a new variable in column E.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    Quote Originally Posted by alice03 View Post
    i have been going back and writing a code for each one to do what i want...
    where is this code ?

  5. #5
    Registered User
    Join Date
    10-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    it is in "thisworkbook" portion

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    try this code, but you have to arrange some lines
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    Thank you I will try it. What lines would I have to arrange?

  8. #8
    Registered User
    Join Date
    10-03-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    I'm a little confused, its not working.

  9. #9
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: How do i avoid having to rewrite the code everytime a new variable is added to the she

    I'm sorry, I don't know the goal of your code, I showed you how you can read the variables.

+ 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. Avoid automatically-added custom views?
    By Mattisrael in forum Excel General
    Replies: 4
    Last Post: 07-24-2013, 04:15 AM
  2. [SOLVED] Looking for help with speeding up or rewrite on vba code.
    By ukchris74 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-16-2013, 01:54 PM
  3. [SOLVED] VBA to Sum the Values into the summary tab everytime when the new worksheet is added
    By Raviprasad.k in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-28-2012, 09:07 AM
  4. [SOLVED] Outlook 2010: Rewrite VBA Code
    By Cansa in forum Outlook Formatting & Functions
    Replies: 3
    Last Post: 10-12-2012, 12:25 PM
  5. Need to rewrite protect code so that it will work with a hidden sheet.
    By mrgillus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2009, 08:17 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