+ Reply to Thread
Results 1 to 8 of 8

Find using TextBox or ActiveCell

  1. #1
    Registered User
    Join Date
    11-12-2011
    Location
    Billericay, UK
    MS-Off Ver
    Home and Business 2013
    Posts
    9

    Find using TextBox or ActiveCell

    Hi,
    I have a code that finds a date in a range using DateValue and then moves to the emptycell below that date. I now want to change the search criteria to search by either the ListBox Value or the ActiveCell Value.
    Here is the code I want to change:
    Please Login or Register  to view this content.
    Please see attached.

    Regards,
    Peter
    Attached Files Attached Files
    Last edited by PCArmour; 11-13-2011 at 11:54 AM. Reason: To make more understandable

  2. #2
    Registered User
    Join Date
    11-12-2011
    Location
    Billericay, UK
    MS-Off Ver
    Home and Business 2013
    Posts
    9

    Re: Find using ListBox or ActiveCell

    Thank's TMShucks, sorry as a new man I'm learning the rules.
    I have tried to make my question clearer and added an example of what I'm trying to achieve.

    My code will eventually cut the active cell row and once the correct blank space has been selected above it I will insert/paste the cut row into its correct date, I can manage this code once the above has been resolved.
    Regards,
    Peter.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,565

    Re: Find using TextBox or ActiveCell

    Sorry, I'm struggling with the logic. And your example didn't have a command button or code.


    Please step through the logic. For example, you put a date into a cell somewhere ... you've put it at the bottom and selected it, I guess, hence you can refer to the ActiveCell. Easy to select the wrong cell, I imagine. I'd be more inclined to put it in a specific cell so I'd know where to look and I could test if it's blank.

    Whatever, you then go up a 150 rows ... why 150 rows? Then you look for what's in the ActiveCell ... but, actually, your code is looking for a hard coded date value, 02/11/2011 ... again, why?

    What exactly are you trying to achieve. Where's the List Box?

    Does this Command Button replace the List Box option or provide an alternative approach?

    Very confused

    Regards, TMS (not Tom)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    11-12-2011
    Location
    Billericay, UK
    MS-Off Ver
    Home and Business 2013
    Posts
    9

    Re: Find using TextBox or ActiveCell

    Hi TMS,
    I'm sorry I havn't explained myself very well.
    The logic is that ListBox2 enters a date from the past few weeks into the ActiveCell (I don't think we need to include what happens before this point) I then want to move this activeCell row to its correct place in the dates above. I therefore select 150 rows above the ActiveCell (this could be 70, 105 or whatever I just went for 150). To move it I Find the same date, go to the empty row below and then insert past the cut row into its correct place in date order. My problem is trying to use the ListBox2 value or the ActiveCell value (which are the same) instead of the DateValue in my current code. As I say, I can do the cutting and pasting.
    I hope that makes sence,
    Regards,
    Peter.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,565

    Re: Find using TextBox or ActiveCell

    Try:

    Please Login or Register  to view this content.

    Regards

  6. #6
    Registered User
    Join Date
    11-12-2011
    Location
    Billericay, UK
    MS-Off Ver
    Home and Business 2013
    Posts
    9

    Re: Find using TextBox or ActiveCell

    Thank you again but no luck with the suggested code.
    I have tried to give a better example on the attached Test Spreadsheet.
    Thanks again for your help.
    Regards,
    Peter.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-12-2011
    Location
    Billericay, UK
    MS-Off Ver
    Home and Business 2013
    Posts
    9

    Smile Re: Find using TextBox or ActiveCell

    Found the right code without using Find

    Please Login or Register  to view this content.
    Thanks for your help any way.

    Regards,
    Peter
    Last edited by PCArmour; 11-13-2011 at 11:53 AM. Reason: Solved

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,565

    Re: Find using TextBox or ActiveCell

    Sorry it didn't help. I'm in France at the moment and using my iPad to keep in touch. Seems like Apple aren't big on supporting Excel on these things.

    What didn't work? For testing, I selected a cell the bottom of the list and then executed the subroutine. It slotted the date into the active cell and then used that to find the cell to update. It seemed to do exactly what (I thought) you wanted.

    Regards, TMS

+ 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