+ Reply to Thread
Results 1 to 4 of 4

Auto number issue

  1. #1
    Forum Contributor
    Join Date
    04-08-2009
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2003
    Posts
    228

    Auto number issue

    Please Login or Register  to view this content.
    The code above adds an autonumber from a form. However, I occasionally get a "Run-time error '13': Type mismatch" If I navigate away from the sheet this code refers to and then go back to it. As if it's not looking at the previous number and adding another.

    Can anyone see an issue with this bit of code or suggest another bit of code that will add an auto number by checking the previous number regardless of where I am in the workbook?

    Hope that makes sense.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Auto number issue

    Missing the all-important dot before the second Range which ties it to the With line.
    Please Login or Register  to view this content.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Auto number issue

    I think you will find that because you do not explicitly refer to the sheet your Rows.Count may be refering to the wrong sheet.

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    04-08-2009
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2003
    Posts
    228

    Re: Auto number issue

    No.freaking.way.

    I.hate.stupid.dots!

    Thank you very much for your help. I never would have seen that!

+ 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