+ Reply to Thread
Results 1 to 6 of 6

ActiveCell problem- value always empty!

  1. #1
    Registered User
    Join Date
    12-21-2010
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    2

    ActiveCell problem- value always empty!

    Hello all,

    I'm currently working on a project in which I have two excel files, and I need to see (by searching for combination of last and first name) if the people contained in wkBook1 are listed in wkBook2.

    I've completed *almost* all of it thus far (code below) but I'm having issues figuring out how to use ActiveCell appropriately. So far I can search through workbooks to see if a person's last name is contained, but if there are two people with the same last name the macro will break if the first one isn't matched.

    I tried solving this by offsetting the "ActiveCell", but it won't enter loop.

    Data to search for:
    Smith, John

    Data Available:
    Smith, Mark <--- search will find mark, doesn't match, then stop.
    Smith, John

    I'm *definitely* not using ActiveCell correctly, as ActiveCell.Value is always "empty" and won't enter loop. Any ideas?

    Thanks!
    ~Jed

    Please Login or Register  to view this content.

  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: ActiveCell problem- value always empty!

    Use FindNext then you won't need to use ActiveCell
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    12-21-2010
    Location
    PA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: ActiveCell problem- value always empty!

    Yes but I still need to use the offset function of the active cell. I could keep finding the "next" one, but how would I then compare the item offset (0, 1) of the "findnext" result?

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

    Re: ActiveCell problem- value always empty!

    It's hard to say more without example data

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,983

    Re: ActiveCell problem- value always empty!

    Your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us help you!

    Read this to understand why we ask you to do this
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: ActiveCell problem- value always empty!

    Quote Originally Posted by SILVERjl View Post
    Yes but I still need to use the offset function of the active cell. I could keep finding the "next" one, but how would I then compare the item offset (0, 1) of the "findnext" result?
    source: Excel VB help file

    FindNext Method

    Continues a search that was begun with the Find method. Finds the next cell that matches those same conditions and returns a Range object that represents that cell. Doesn’t affect the selection or the active cell.

    expression.FindNext(After)
    expression Required. An expression that returns a Range object.

    After Optional Variant. The cell after which you want to search. This corresponds to the position of the active cell when a search is done from the user interface. Note that After must be a single cell in the range. Remember that the search begins after this cell; the specified cell isn’t searched until the method wraps back around to this cell. If this argument isn’t specified, the search starts after the cell in the upper-left corner of the range.

    Remarks
    When the search reaches the end of the specified search range, it wraps around to the beginning of the range. To stop a search when this wraparound occurs, save the address of the first found cell, and then test each successive found-cell address against this saved address.

    Example
    This example finds all cells in the range A1:A500 that contain the value 2 and changes their values to 5.

    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