+ Reply to Thread
Results 1 to 7 of 7

Trouble with Macro duplicating duplicate table names (Operator Error :))

  1. #1
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Trouble with Macro duplicating duplicate table names (Operator Error :))

    Alright, so I created a Macro via Macro Recorder to duplicate the sheet formatting for new employers from the "Royal" sheet. But the code doesn't work well because the code says to duplicate the same table name. Is there away to get the code to add the table and auto name it to something else each time? The macro's name is "Add_New_Employer" and I will be attaching it to the button in the summary tab once I figure everything out... I'm really sorry that the Macro code looks like doodoo; I was clicking around a lot while the recorder was going. Any help would be greatly appreciated.

    OJT Tracker v1.3 (Excel Forum Example).xlsm

    FYI when I tried to attach some code, the site's firewall came up. So that's why I didn't put any code in the thread.
    Last edited by Kogen; 11-16-2018 at 12:18 PM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    To post code, simply copy it from your file and paste it into the thread pane here. Then use the mouse pointer to highlight the code and click on the pound symbol (#) to put code tags around the code you pasted so it will retain formatting and can be easily copied if need be. To attach a copy of your file, click the 'GoAdvanced' button at the bottom of the reply pane then select 'Manage Attachments' and follow the options. Your original attachments cannot be accessed.
    Last edited by JLGWhiz; 11-16-2018 at 11:02 AM.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    JLGWhiz, when I copy and paste it into the thread it tells me that there is 40K + characters and 15K is the max. Then when I try to shorten it, the site's firewall pops up on me...

  4. #4
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    JLGWhiz, when I copy and paste it into the thread it tells me that there is 40K + characters and 15K is the max. Then when I try to shorten it, the site's firewall pops up on me... the file attachment works now though.

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    Quote Originally Posted by Kogen View Post
    JLGWhiz, when I copy and paste it into the thread it tells me that there is 40K + characters and 15K is the max. Then when I try to shorten it, the site's firewall pops up on me... the file attachment works now though.
    Try to copy only the part that deals with copying and pasting your table(s). BTW, 40K is a lot of code for a macro. You should think about trying to break it up into multiple macros that are controlled by a Main macro that calls the others.
    Example
    Please Login or Register  to view this content.
    You can make your variables global in that workbook so that you only have to declare them once and can use them in all the macros. But be careful using golbal variables because their values remain the same from the last time initialized until re-initialized with the (=) equal sign in the code. Don't know what coding level you are at, but you should understand what I am trying to explain.

    Maybe we can tie the problem down another way.
    1. By table name(s), do you mean the ListObject RefersTo: name? or a title entered in a cell on the worksheet?
    2. Is the duplication done by copying and pasting, or is it done by creating new tables using the same code?
    3. Any other explanation?
    Last edited by JLGWhiz; 11-16-2018 at 06:17 PM.

  6. #6
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    JLGWhiz,

    I do not have any experience in coding, I have only just begun using the Macro Recorder. What I ended up doing was starting the macro recorder, formatting the worksheet (Macro Result) exactly as my first worksheet (Royal); no copy and pasting was used. My mindset was to have the command button in the "Summary" sheet so that when I get a new company to begin tracking, I'd be able to start with a fresh sheet ready for data entry. When I run the macro, it causes an error because it is trying to use an existing table's name.... it think.

  7. #7
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Trouble with Macro duplicating duplicate table names (Operator Error :))

    My experience with tables is almost zero and without seeing the code, I cannot be of much help. Maybe someone else with more experience with List Objects will pick up on the thread and give some assistance.
    Regards, JLG

+ 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. [SOLVED] extract one of the duplicate names in the table below
    By sami204098 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-01-2018, 05:49 AM
  2. Replies: 2
    Last Post: 11-14-2015, 12:39 PM
  3. Duplicating Macro (Sorry if this is a duplicate post)
    By midwest trader in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-10-2014, 09:09 AM
  4. Replies: 1
    Last Post: 08-23-2013, 05:45 PM
  5. [SOLVED] Duplicate Indicator Macro Trouble
    By Christopher Wait in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-21-2012, 06:51 PM
  6. Macro trouble for a novice - txt files, worksheets, tab names, excel
    By SkipperN in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-02-2012, 12:04 PM
  7. [SOLVED] Error Handling for Duplicate Worksheet Names
    By MWS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2006, 02:25 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