+ Reply to Thread
Results 1 to 6 of 6

VBA Code Error - Copy From 1 Workbook to Another

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    VBA Code Error - Copy From 1 Workbook to Another

    I Have 2 Workbooks, "New Microsoft Office Excel Worksheet.Xlsx" & "sd.xlsx"

    I have put up a code where the data in cells D4,D5,D6 from the 1st workbook gets copied in the Workbook named SD.

    The Code is runnin just fine, except for the last 2 lines where I am trying to save and close SD Workbook.

    Can anyone point out what is wrong?


    Please Login or Register  to view this content.
    Cheers!
    Deep Dave

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Code Error - Copy From 1 Workbook to Another

    To refer to the workbook all you need is the filename, not the path.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: VBA Code Error - Copy From 1 Workbook to Another

    Maybe replace your last two lines with
    Please Login or Register  to view this content.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: VBA Code Error - Copy From 1 Workbook to Another

    Done.. Thanx a ton..

    Any Improvement I can do to make the above code better??

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Code Error - Copy From 1 Workbook to Another

    You could probably get rid of this loop.
    Please Login or Register  to view this content.
    Something like this perhaps.
    Please Login or Register  to view this content.

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,873

    Re: VBA Code Error - Copy From 1 Workbook to Another

    Thank You for the suggestion!


+ 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