+ Reply to Thread
Results 1 to 5 of 5

Using a Macro that switches between workbooks

  1. #1
    Jorge
    Guest

    Using a Macro that switches between workbooks

    I have tried to create a macro that will copy and paste information between
    two woorkbooks. One of these always has the same file name (and is a read
    only template) where as the other will vary as it is used by different
    individuals.

    Can this be done?

    Regards
    Jorge

  2. #2
    Chip Pearson
    Guest

    Re: Using a Macro that switches between workbooks

    Try something like

    Workbooks("Book5.xls").Worksheets("SHeet1").Range("A1:A5").Copy _
    Destination:=Workbooks("Book6.xls").Worksheets("Sheet1").Range("A1")


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Jorge" <[email protected]> wrote in message
    news:[email protected]...
    >I have tried to create a macro that will copy and paste
    >information between
    > two woorkbooks. One of these always has the same file name (and
    > is a read
    > only template) where as the other will vary as it is used by
    > different
    > individuals.
    >
    > Can this be done?
    >
    > Regards
    > Jorge




  3. #3
    Jorge
    Guest

    Re: Using a Macro that switches between workbooks

    Thanks Chip,

    But as I'm not a programmer I'm not sure if I was able to take advantage of
    your advice. Would you posibly be able to be a little more exlplicit in my
    case.

    It didn't seem to help. In any case whatever I name the variable file there
    is no way I can control what others will name theirs. The file is actually a
    work time sheet so the file name will contain a date, which as you can
    imagine changes regularly.

    Regards
    Jorge

    "Chip Pearson" wrote:

    > Try something like
    >
    > Workbooks("Book5.xls").Worksheets("SHeet1").Range("A1:A5").Copy _
    > Destination:=Workbooks("Book6.xls").Worksheets("Sheet1").Range("A1")
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    > "Jorge" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have tried to create a macro that will copy and paste
    > >information between
    > > two woorkbooks. One of these always has the same file name (and
    > > is a read
    > > only template) where as the other will vary as it is used by
    > > different
    > > individuals.
    > >
    > > Can this be done?
    > >
    > > Regards
    > > Jorge

    >
    >
    >


  4. #4
    Rich Mcc
    Guest

    Re: Using a Macro that switches between workbooks

    cant you put the code in the file which the date changes and get it to open
    and extract the data from the one that is always nammed the same



    "Jorge" wrote:

    > Thanks Chip,
    >
    > But as I'm not a programmer I'm not sure if I was able to take advantage of
    > your advice. Would you posibly be able to be a little more exlplicit in my
    > case.
    >
    > It didn't seem to help. In any case whatever I name the variable file there
    > is no way I can control what others will name theirs. The file is actually a
    > work time sheet so the file name will contain a date, which as you can
    > imagine changes regularly.
    >
    > Regards
    > Jorge
    >
    > "Chip Pearson" wrote:
    >
    > > Try something like
    > >
    > > Workbooks("Book5.xls").Worksheets("SHeet1").Range("A1:A5").Copy _
    > > Destination:=Workbooks("Book6.xls").Worksheets("Sheet1").Range("A1")
    > >
    > >
    > > --
    > > Cordially,
    > > Chip Pearson
    > > Microsoft MVP - Excel
    > > Pearson Software Consulting, LLC
    > > www.cpearson.com
    > >
    > >
    > >
    > > "Jorge" <[email protected]> wrote in message
    > > news:[email protected]...
    > > >I have tried to create a macro that will copy and paste
    > > >information between
    > > > two woorkbooks. One of these always has the same file name (and
    > > > is a read
    > > > only template) where as the other will vary as it is used by
    > > > different
    > > > individuals.
    > > >
    > > > Can this be done?
    > > >
    > > > Regards
    > > > Jorge

    > >
    > >
    > >


  5. #5
    Jorge
    Guest

    Re: Using a Macro that switches between workbooks

    Rich,

    It doesn't work that way. The reason being that firstly it's protected
    worksheet with only specific cells unprotected. Secondly, as the macro needs
    to refer back to the variable workbook to copy information, once the filename
    changes the macro is no longer viable. This is the hurdle, if at all
    possible, I'm trying to overcome.

    Regards
    Jorge


    "Rich Mcc" wrote:

    > cant you put the code in the file which the date changes and get it to open
    > and extract the data from the one that is always nammed the same
    >
    >
    >
    > "Jorge" wrote:
    >
    > > Thanks Chip,
    > >
    > > But as I'm not a programmer I'm not sure if I was able to take advantage of
    > > your advice. Would you posibly be able to be a little more exlplicit in my
    > > case.
    > >
    > > It didn't seem to help. In any case whatever I name the variable file there
    > > is no way I can control what others will name theirs. The file is actually a
    > > work time sheet so the file name will contain a date, which as you can
    > > imagine changes regularly.
    > >
    > > Regards
    > > Jorge
    > >
    > > "Chip Pearson" wrote:
    > >
    > > > Try something like
    > > >
    > > > Workbooks("Book5.xls").Worksheets("SHeet1").Range("A1:A5").Copy _
    > > > Destination:=Workbooks("Book6.xls").Worksheets("Sheet1").Range("A1")
    > > >
    > > >
    > > > --
    > > > Cordially,
    > > > Chip Pearson
    > > > Microsoft MVP - Excel
    > > > Pearson Software Consulting, LLC
    > > > www.cpearson.com
    > > >
    > > >
    > > >
    > > > "Jorge" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > >I have tried to create a macro that will copy and paste
    > > > >information between
    > > > > two woorkbooks. One of these always has the same file name (and
    > > > > is a read
    > > > > only template) where as the other will vary as it is used by
    > > > > different
    > > > > individuals.
    > > > >
    > > > > Can this be done?
    > > > >
    > > > > Regards
    > > > > Jorge
    > > >
    > > >
    > > >


+ 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