+ Reply to Thread
Results 1 to 6 of 6

Copying a range from a Personal file

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    Broxbourne, Herts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Copying a range from a Personal file

    Hi

    Not sure if my thinking is the right way to go about this so would appreciate some help.

    What I need to do is put data that I get on a variery of excel speadsheets into a standard template. I can do this by the process of copying over column by column the appropriate detail from one workbook to the other.

    what I'd like to do is replicate the column headings of the template onto the workbook with the original data so I'm looking at just one workbook all the while until I'm ready to transfer all the data in one go.

    I realise I can just copy from the template to the active workbook, but what I had in mind was having the ability to hit a button to replicate it associated with a macro.

    So the macro I'd want would involve starting from a cell in the active workbook, obtaining a named range from my personal workbook (which would be the template headings) and then pasting this back into the active cell of the active workbook.

    First of all....is this a sensible approach? And if it is feasible...how would I get it to work (taking into consideration the Personal workbook may be hidden).

    the only code i have at the moment is

    Workbooks("PERSONAL.XLSB").Worksheets(1).Range("MODELTEMPLATE").Copy

    But how would I get this to paste onto the cell I start with?

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,346

    Re: Copying a range from a Personal file

    You were close - it does not matter that Personal is hidden:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    11-07-2012
    Location
    Broxbourne, Herts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copying a range from a Personal file

    Many thanks for the reply Bernie......I'm still getting a debug screen however.

    So...if I'm on Book1 cell C7 for example.....and I run the macro..I'm hoping to get a paste of the cells I have stored as a name within the Personal file as MODELTEMPLATE in my personal book beginning at C7 as a result. I've got the above in one line so I'm not sure what stage it's stopping me.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,346

    Re: Copying a range from a Personal file

    Let's break it down:

    Msgbox Workbooks("PERSONAL.XLSB").Name
    Msgbox Workbooks("PERSONAL.XLSB").Worksheets(1).Name
    Msgbox Workbooks("PERSONAL.XLSB").Worksheets(1).Range("MODELTEMPLATE").Address

    If it fails on the third one - it should fail on the third line - it may be that your named range is not on the first sheet, or the name is slightly different....

  5. #5
    Registered User
    Join Date
    11-07-2012
    Location
    Broxbourne, Herts
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Copying a range from a Personal file

    Apologies Bernie.......as soon as I read your comment about the named range not being on the first sheet......i knew it wasn't and the penny dropped.

    that's fantastic thanks....works a treat now

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,346

    Re: Copying a range from a Personal file

    That's great

+ 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. Copying a range of tabs in one file to the end of another file
    By som3on3_10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2011, 04:40 AM
  2. Copying macros from a file to Personal Workbook
    By excel nubie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2007, 12:31 PM
  3. [SOLVED] Problem copying a range to another file
    By Bob Lehrer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2006, 08:10 AM
  4. Copying range from another file
    By Chente28 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2005, 09:05 PM
  5. copying Personal.xls
    By mkingsley in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2005, 11:11 PM

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