+ Reply to Thread
Results 1 to 3 of 3

Macro exporting and saving the wrong page with wrong name

  1. #1
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Macro exporting and saving the wrong page with wrong name

    This macro looks for the account # and then exports that worksheet with the listed filename. However it is always saving the second row as the wrong sheet. For example, in the attached workbook there are two filenames listed on sheet 1. Sheet 2&3 are for those. It should take sheet 2 and export it with the filename in A1 and export sheet 3 with the filename in A2. It does the first export correctly, but it is exporting sheet 1 with the filename in A2. Normally there are about 210 listed filenames. They are ALL right except for the 2nd filename listed.


    It is whatever is listed in A2.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by taylorsm; 08-08-2018 at 11:56 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,532

    Re: Macro exporting and saving the wrong page with wrong name

    Your loop is checking to see if the number in the third position of the Notes sheet is found in cell A2 of any of the sheets. When you get to the second row, you are checking to see if

    FIGUEROA, Tom, 1029518997, 10.07.2018, 1521, Inbound

    is found within cell A2 of each sheet. Well, guess what--that number is found in cell A2 of Notes, because that's where you got it from in the first place. So it prints the Notes sheet.

    To avoid this modify as shown:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-09-2016
    Location
    USA,USA
    MS-Off Ver
    2016
    Posts
    1,192

    Re: Macro exporting and saving the wrong page with wrong name

    Thank you!

    This use to be a better way and had more identifiers to help prevent this kind of stuff. Then they changed our systems and my the reports changed and crippled my stuff. I've been playing catch up ever since.

+ 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. Replies: 7
    Last Post: 03-12-2018, 11:45 AM
  2. wrong macro? doing something wrong?
    By weatherguard in forum Excel General
    Replies: 1
    Last Post: 03-04-2016, 06:30 PM
  3. Whats wrong with saving file like this?
    By kjvenky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2012, 07:58 AM
  4. exporting in wrong cell format
    By tuffthegamer in forum Excel General
    Replies: 1
    Last Post: 11-23-2009, 06:51 PM
  5. Saving in wrong location
    By jojotherider in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2007, 03:29 PM
  6. Saving in wrong location
    By chris_mayer in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 09-06-2007, 05:08 AM
  7. How can you restore a document after saving it wrong?
    By Carrinna in forum Excel General
    Replies: 5
    Last Post: 03-13-2006, 08:26 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