+ Reply to Thread
Results 1 to 5 of 5

Code works just the first time

  1. #1
    Registered User
    Join Date
    04-08-2010
    Location
    Timisoara, Romania
    MS-Off Ver
    Excel 2003
    Posts
    23

    Code works just the first time

    Hello,

    I have the following code
    Please Login or Register  to view this content.
    I searches for the fist empty cell in row 3 and when it finds it puts a name saved in the variable "nume". The first time I hit the button works perfectly, but after that it doesn't do anything.

    Any idea what's work? Thank you

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

    Re: Code works just the first time

    It's an inefficient way to find the next empty cell in my opinion. I would ude

    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

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: Code works just the first time

    This works as described for me. Is it possible that the variable "nume" is reset elsewhere in your code?
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Registered User
    Join Date
    04-08-2010
    Location
    Timisoara, Romania
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Code works just the first time

    Hey again,

    @royUK: Thank you for you answer! It works just fine for the first empty row in column 3, but I am looking for the first empty column in row 3 and I don't know how to modify it so it does what I want

    @sweep: Thank you for you answer! I put a message box just before "Cells(3, x).Value = nume" and it shows me the right value for nume, so it isn't reset anywhere

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

    Re: Code works just the first time

    Sorry I misread, just a slight amendment

    Please Login or Register  to view this content.

+ 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