+ Reply to Thread
Results 1 to 2 of 2

How to declare variable names depending on worksheet names

  1. #1
    Registered User
    Join Date
    11-10-2007
    Location
    Sweden
    Posts
    32

    How to declare variable names depending on worksheet names

    I need to do the following,

    I have a workbook with lots of worksheets in it and each worksheet contains lots of links, for example a link named abc123456 that opens the abc123456 worksheet. The problem is that the cursor is always placed at cell A1 in the abc123456 sheet that is open. I need the cursor to stay at the same location as it was before, because I will copy and paste with vba code and need to know what row that was last copied, (that is the same as the cursor was last placed on) but i guess that is not possible when using links within workbooks like this.

    So to solve this, I though I could create a variable for each worksheet that is created and store the
    possition of the cursor with this code:

    Please Login or Register  to view this content.
    But, I want the "sheetrng" name to created automatically depending on the worksheet name.
    For example if the worksheet name is abc123456, then the I would like the line to declare the
    variable to be like this.

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    If I can manage to do this, then I know what line I was last on and can then place the cursor at the "right" row after following a link.

    Would very much like help to solve this.
    Thank you

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475
    Here is one example
    selecting the same cell in a different workbook
    Please Login or Register  to view this content.

+ 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