+ Reply to Thread
Results 1 to 6 of 6

Ending Macros

  1. #1
    Registered User
    Join Date
    09-29-2008
    Location
    USA
    Posts
    16

    Ending Macros

    I have a macro that continues to tell me that an End With and/or End Sub is expected. I continue to add these statements in various ways, but the macro will not complete properly.

    Here is the code:

    Please Login or Register  to view this content.
    What is the proper order / format for these statements?
    Last edited by lj123; 11-21-2008 at 12:36 AM.

  2. #2
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    Hi

    there are two With Statement , so you require two End With....

    So you require one more End With... that should be placed before second with


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-29-2008
    Location
    USA
    Posts
    16

    Ending Macros

    Thank you for that information but i am still having trouble. The problem may be that several people have offered advice on improving this macro but i have only included parts of the macro each time. Now I think i need advice on the macro as a whole. The whole macro is provided below. What I am trying to accomplish it copy many parts of a purchase order to a master customer database. the purchase order is File 1 and the Customer database is File 2.

    I feel like there is a lot of extra steps in this macro preventing it from working. This is a long macro, but there are a lot of individual cells in File 1 that need to be copied to individual cells in File 2. Any help would be appreciated.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    I'd recommend something a little more direct and easier. Just copy the values directly using the format

    [destination].Value = [source].Value
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 11-12-2008 at 12:35 PM.
    _________________
    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!)

  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
    By the way, as I changed the format of your macro I spotted TWO typos in your macro that would cause problems.
    Please Login or Register  to view this content.
    Notice the extra period. And...
    Please Login or Register  to view this content.
    Notice the missing "3".

  6. #6
    Registered User
    Join Date
    09-29-2008
    Location
    USA
    Posts
    16

    Ending Macros

    Thank you J that does seem more straight forward and thank you for catching the errors. However when I implemented the code you suggested I receive a Run Time Error '438' Object doesn't support this property or method.

    When debugging it highlights the first row that identifies the destination and source. Any thoughts?

+ 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