Results 1 to 3 of 3

Error “A table can’t overlap another table” when creating a new sheet

Threaded View

  1. #1
    Registered User
    Join Date
    05-13-2019
    Location
    Eskilstuna
    MS-Off Ver
    Office 2016
    Posts
    45

    Error “A table can’t overlap another table” when creating a new sheet

    I have a really strange problem that’s been bothering me for some time now. I have this planning workbook, it’s for a small stab – they want to plan their time schedule for a year ahead for every co-worker. The workbook is built on a couple of sheets, Template, calendar and so on - most of them are hidden. At the start-sheet there are this button “Ny medarbetare” who is the button to create a new sheet for every co-worker. First you come to a form where it’s necessary to fill every textbox and then you push on the button “Skapa” to create the new sheet. And here is where the problem starts and ONLY if there are no other sheets for co-workers. If there are other co-worker sheets it’s seems to be working fine (seems maybe is the keyword though it’s has’nt been testing yet). But if there is no other co-worker sheets yet, I get this error “A table cant overlap another table” and then its creating a Template(2) out of an existing sheet (and just rename it) and a co-workers sheet that is only half created and without the template.

    I’m not that experienced with VBA so this is really bothering me. Adding some pictures of the described errors and the code that is creating the new sheet.

    Set sh = createSheetFromTemplate(frm.txtName.Text)
    Private Function createSheetFromTemplate(sheetName As String) As Worksheet
        Dim sheetCount As Integer
        Dim newSheetName As String
        
        sheetCount = Sheets.Count
        Sheets("Template").Copy After:=Sheets(sheetCount)
        Sheets(sheetCount + 1).name = sheetName
        Sheets(sheetName).Visible = True
        Sheets(sheetName).Select
        Set createSheetFromTemplate = ActiveSheet    
    End Function
    Hope anyone has any ideas.
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 12-08-2017, 02:41 PM
  2. Creating a table based on a table in another sheet
    By kwjoh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2015, 04:09 PM
  3. Run Time Error "1004": A table cannot overlap another table
    By Shermaine2010 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2015, 06:30 AM
  4. Run-time error 1004 Table Cannot Overlap A Range...
    By dearnemo385 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2012, 08:19 AM
  5. Run-time error 1004 Table Cannot Overlap A Range...
    By passmaster16 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-11-2012, 10:21 AM
  6. Replies: 0
    Last Post: 05-09-2012, 03:59 PM
  7. Creating a filtered table from a source table in another sheet
    By penfold in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2008, 07:44 AM

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