+ Reply to Thread
Results 1 to 4 of 4

Making a reference point for my macro

  1. #1
    Registered User
    Join Date
    12-09-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    68

    Making a reference point for my macro

    I am trying to set up a macro that combines different sheets in a workbook. This number of sheets will change each time so currently, I have to go back in and change the number each month.

    For x = 1 To 27
    some months it will be
    For x = 1 To 30
    etc.

    I was trying to make a reference point in the workbook that will change the code depending on what number is in that reference point (so humans don't mess up my macro )

    The idea being something like this:

    For x = 1 To Sheets("the reference sheet") Range( "the number relevant for that months report)

    Any advice?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Making a reference point for my macro

    Hello afriedman,

    You answered your own question. You need only add the range address where you have the value stored to your statement below...
    Please Login or Register  to view this content.

    Would look like this in code. Change the sheet name and cell address to what you need.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    12-09-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: Making a reference point for my macro

    Duh! Thanks.

    I am still learning the code and just getting really into Macro's.

    Thanks again for your help!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Making a reference point for my macro

    Hello afriedman,

    You're welcome. We were all beginners once.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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