+ Reply to Thread
Results 1 to 9 of 9

Set Worksheets to 2

  1. #1
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    287

    Set Worksheets to 2

    Hi, i was looking for some help with a macro I have written. What I was looking to find out is if it is possible to have 2 worksheets that are set as WS1.

    Currently I have the following:

    Please Login or Register  to view this content.
    but I need the macro to run on 2 sheets i.e.

    Please Login or Register  to view this content.
    but this gives me an error, any ideas on how i can get this to work?

    Thanks in advance.

  2. #2
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Set Worksheets to 2

    perhaps
    Please Login or Register  to view this content.
    . But I do not know the purpose, until seeing a sample w.book or posting of further details
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  3. #3
    Registered User
    Join Date
    04-18-2011
    Location
    Bucharest, Romania
    MS-Off Ver
    Excel 2019
    Posts
    90

    Re: Set Worksheets to 2

    probably not the best solution

    copy/paste your macro, renaming it so you'll have the original macro1 and macro2, which do the same thing.

    macro 1 will have
    Please Login or Register  to view this content.
    macro 2 will have
    Please Login or Register  to view this content.
    now create a main macro and call the other macros

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    526

    Re: Set Worksheets to 2

    perhaps
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    287

    Re: Set Worksheets to 2

    thanks for the replies, i will try these and let u no how i get on.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Set Worksheets to 2

    This
    Please Login or Register  to view this content.
    should be

    Se
    Please Login or Register  to view this content.
    You can't set one variable to two worksheets at the same time. It's not clear what you want to do so this shows how to use one variable on different sheets, but not at the same time

    Please Login or Register  to view this content.
    Last edited by royUK; 05-04-2011 at 07:33 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Contributor
    Join Date
    06-16-2008
    Posts
    287

    Re: Set Worksheets to 2

    royUK, thanks for your response. I have a macro that will toggle between the number of jobs an individual has undertaken and the time this has taken him.

    Unfortunately I have had issues with another part of the workbook, as the vlookups I have on my main sheet look through 250 different sheets within the same file (as they also toggle between time and %) so i have had leave the formulas in their but when opening the file on some colleagues their computer freezes so I have had to rethink the vlookups.

    So what I have done now is copied the main sheet so i now have 2. Where the vlookups were, the first main sheet shows the time, the second the % but the problem now is that the macro I have that would grab the number of jobs an individual has undertaken or the time this has taken him only gets changed on the first main sheet as this is what WS1 has been set to hence the reason why i needed this to work on 2 sheets at the same time.

    Sorry if i have gone on abit, but hopefully that makes a bit more sense as to why I need to define 2 worksheets. Also if any1 can give any other suggestions compared to what I have done then feel free to let me know. Would really appreciate it.

    Thanks for all your help once again.

  8. #8
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Set Worksheets to 2

    Please Login or Register  to view this content.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Set Worksheets to 2

    250 sheets in one workbook is bound to cause problems with all the associated formulas. I think you have a design issue & VBA is not a remedy

+ 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