+ Reply to Thread
Results 1 to 5 of 5

Copy and Paste Dynamic Range by a Sheets Codename rather than its name

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Cary
    MS-Off Ver
    Excel 2003
    Posts
    18

    Copy and Paste Dynamic Range by a Sheets Codename rather than its name

    A userform was designed to compile a template list of project names into a dropdown combobox. When the type of project is selected the code needs to copy the Templates (sheet's codename) range into the Gantt (sheet's codename) next available row. I expect the user to change the name of the sheet so copying and pasting with codenames is more ideal. I can't seem to get this to function the way I am coding it.

    This example works but seems limited to the absolute range references to me:

    Please Login or Register  to view this content.
    The way I'm attempting to code this is something like the following which tries to turn the range into a string for insertion into the above format:

    Please Login or Register  to view this content.
    This looks messy but I can't seem to hunt down a good way to work with dynamic codename references. Any thoughts on this problem?

    Kind regards,

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copy and Paste Dynamic Range by a Sheets Codename rather than its name

    Try a different syntax:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

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

    Re: Copy and Paste Dynamic Range by a Sheets Codename rather than its name

    Hello evancharles,

    Just so you know, a worksheet has a Name property and a CodeName property. The Name property can be changed by the user. The CodeName property is assigned by Excel when a worksheet is created and can not be changed by the user.

    Both worksheet names Templates and Gantt are Worksheet Name properties. The CodeName properties might be Sheet1 and Sheet2. You can verify the names in your VBA Project under the Microsoft Excel Objects. For example, Templates might look like Sheet1(Templates) in the Project Explorer. Where Sheet1 is the CodeName and Templates the worksheet Name.
    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!)

  4. #4
    Registered User
    Join Date
    10-15-2012
    Location
    Cary
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Copy and Paste Dynamic Range by a Sheets Codename rather than its name

    Thanks Jerry. That seemed to do the trick.

    Thanks for mentioning that Leith. I updated the (name) property from sheet1 and sheet 2 to Templates and Gantt, respectively. The 'Name' is the one which users can manipulate.
    Last edited by evancharles; 12-13-2015 at 06:29 PM.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Copy and Paste Dynamic Range by a Sheets Codename rather than its name

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Conditional Copy/Paste Dynamic Range
    By dyoo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2015, 09:43 PM
  2. VBA- Macro for copy and paste of dynamic info in certain sheets into summary sheet
    By Theresa.L.Waysone in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-25-2014, 04:55 PM
  3. [SOLVED] Copy/Paste Dynamic Range
    By RedStick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2014, 03:38 PM
  4. [SOLVED] Copy and Paste Dynamic Range
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2013, 11:14 AM
  5. Dynamic offset range copy/paste
    By elxan0611 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2010, 04:45 AM
  6. Copy dynamic range from previous sheet and paste after last used row in a range
    By Mistweaver in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-04-2010, 06:24 PM
  7. Copy and paste dynamic range
    By wpryan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-16-2010, 09:42 AM

Tags for this Thread

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