+ Reply to Thread
Results 1 to 10 of 10

macro to return to where user was working

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    25

    macro to return to where user was working

    i have an excel doc. with three sheets...
    i may start that macro on any sheet any cell
    the 1st thing that macro does is to go to sheet1 and after running the whole code it calls another macro... macro2

    now macro2 runs in an infinte loop and runs evry 20 sec. the problem is every 20 sec the cursor comes back to sheet3.. i want the macro to return to the place where the user was working.. best wud be that the user can work seem lessly...
    Last edited by hotmalepiyush; 05-29-2008 at 01:51 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681
    Don't use Select/Activate in your code, unleass it really need to.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493
    Quote Originally Posted by hotmalepiyush
    i have an excel doc. with three sheets...
    i may start that macro on any sheet any cell
    the 1st thing that macro does is to go to sheet1 and after running the whole code it calls another macro... macro2

    now macro2 runs in an infinte loop and runs evry 20 sec. the problem is every 20 sec the cursor comes back to sheet3.. i want the macro to return to the place where the user was working.. best wud be that the user can work seem lessly...
    plz help
    is not much of a title,
    please edit your title,
    Also, how is anybody supposed to know what is wrong with the code if you do not display it?

  4. #4
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    cannot do without select

    macro is something like this(on another pc)
    Please Login or Register  to view this content.
    note: this is just to give an idea of the code
    Last edited by royUK; 05-29-2008 at 03:37 AM.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    thanx a lot.. got a good idea..

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

    You need to read the Forum Rules & abide by them. Now you haven't used Code tags. I will add them this time, but in future you may well find your post locked if you do not follow the Rules!
    Hope that helps.

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

    Free DataBaseForm example

  8. #8
    Registered User
    Join Date
    05-27-2008
    Posts
    25

    using paste avoiding select

    i was able to use ur way in all cases except one

    when using paste(i need background colors fo cells) how can i avoid select// please help

    my code is
    Please Login or Register  to view this content.
    the last two line when replaced with :

    range("e2").paste doest work..

    is there any way i can use special paste n copy colors at the same time??
    Last edited by davesexcel; 05-30-2008 at 07:50 AM.

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,493
    Quote Originally Posted by hotmalepiyush
    i was able to use ur way in all cases except one

    when using paste(i need background colors fo cells) how can i avoid select// please help

    my code is

    range("a2:a22).copy
    range("E2").select
    activesheet.paste

    the last two line when replaced with :

    range("e2").paste doest work..

    is there any way i can use special paste n copy colors at the same time??
    Are you actually reading the posts???
    Please place your code between the code tags.........

    BTW did you know you can copy and paste code instead of rewriting it?


    Please Login or Register  to view this content.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,681
    Paste method is for a Worksheet object, whereas PasteSpecial is for a Range object and does not have destination protocol.
    Therefore
    Please Login or Register  to view this content.
    Need to be 2 lines.

+ 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