+ Reply to Thread
Results 1 to 22 of 22

understanding how FindFirst works.

  1. #1
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    understanding how FindFirst works.

    How do I use Find to locate the first occurence of a particular value in a cell, and return the row that the cell is in?



    Thanks in advance.
    Last edited by gshock; 03-05-2008 at 11:15 AM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    see link for more

    http://www.ozgrid.com/VBA/find-method.htm

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    Post

    VBA Noob,
    That worked fantastic. I don't need the message box, but I want to take that row, and delete all rows above it. Can you tell me how to modify the code to do that?

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    VBA Noob,
    Outstanding! That worked great. Now, is there a way to isolate "STAGE" versus "Stage" and "stage"?

    This is a data dump as a text file, and that word appears in different forms. But when it's in CAPS, it denotes the start of the data that I want to manipulate.

    Thanks for your help. This is great.

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Please Login or Register  to view this content.
    VBA Noob

  7. #7
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    VBA Noob,
    Bummer. That didn't work. The macro still runs, but it doesn't recognize the difference. That word occurs various times, depending on the size the of data that we get in the output file.

    How do I combine the code you gave me with other code that I'm adding so that it all runs in one big macro? If I comment out Sub FindWord(), then I get the following error:

    Run-time error '1004':

    Method of 'Range of object '_Global' failed.

    Thanks again. This is really helpful.
    Last edited by gshock; 03-05-2008 at 12:05 PM.

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    The macro still runs, but it doesn't recognize the difference.
    Does on my sample page

    How do I combine the code you gave me with other code that I'm adding so that it all runs in one big macro
    Would have to see your code first.....remember to wrap code as per forum rules below

    VBA Noob

  9. #9
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    What I want to do is combine the code you gave me into the SXS_Data_Sort() macro that I'm trying to build. I want to have several operations contained within that one macro.


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

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Please Login or Register  to view this content.
    VBA Noob

  11. #11
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    VBA Noob,

    Thanks. Everything works great, but I'm still not getting it to differentiate between the variations of "Stage", "stage", and "STAGE". Do you want to see a sample of the data? And how do I upload it so you can see it?

    Thanks a TON for your help. Much appreciated.

    -gshock

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Zip(Compress) the file then use the paperclip symbol to attach the file

    VBA Noob

  13. #13
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    Question

    VBA Noob,
    I tried the same code with this data, and it has the same result. It goes to the next occurence of the word 'stage' in any form, and deletes the rows above. I haven't listed all the data here, so you won't see "STAGE" as such. But if you run the macro, you'll see that it deletes a group of rows each time you run the macro.

    Thanks so much for your help.
    Attached Files Attached Files

  14. #14
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your data doesn't contain a upper case "STAGE" so won't delete anything

    B$1,1 "Stage Estimator Template File"
    (stage 1
    (stage 2
    (stage 3
    (stage 4
    (stage 5
    (stage 6
    (stage 7
    (stage 8
    (stage 9
    VBA Noob

  15. #15
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    Question

    VBA Noob,
    When I run the macro in my sheet, it will delete one set of 'stage' data at a time. So it's basically stepping through the data. I'm not sure why it sees the "STAGE" for you, and not me. Do I need to format the cells as text first?

  16. #16
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    Here's the data file down to the "STAGE" entry.
    Attached Files Attached Files

  17. #17
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    As per my post 6 you need to change

    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    VBA Noob

  18. #18
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208
    VBA Noob,

    Now, I'm learning. I didn't realize that I didn't change that piece. Now I see why it's important. Thanks. That worked great. Now, how can I modify that code to find a specific occurence of that? Say, for example, if I wanted to find the 4th occurence of that word, "STAGE".

    This is excellent. Thank you so much for your help.

    -gshock
    Last edited by gshock; 03-05-2008 at 03:45 PM.

  19. #19
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    Cool Solved

    SOLVED

    Thanks for all your help.

  20. #20
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    This finds the 4th and deletes

    Please Login or Register  to view this content.
    VBA Noob

  21. #21
    Forum Contributor
    Join Date
    03-04-2008
    Location
    Ohio
    MS-Off Ver
    Office 2010
    Posts
    208

    Thumbs up

    VBA Noob.
    Thanks for all the help. I can't tell you how much you've improved my day.

    Much appreciated.

    -gshock

  22. #22
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Your welcome

    VBA Noob

+ 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