Consulting

Results 1 to 8 of 8

Thread: Using Find function in VBA

  1. #1
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location

    Using Find function in VBA

    Hi there,

    I’m trying to use the Find function in VBA, with not much luck.
    I have a sheet of data, and I’d like to be able to find text in column A (“Growthpoint”) and move each occurrence (entire row) of that word up to underneath the first occurrence.
    And then insert a blank row underneath the grouping.
    Please refer to “Before” and “After” attachments.
    I’d appreciate any help, been stuck on this for days!

    Thank you.
    Attached Images Attached Images

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Show us the code that you tried Jacqui, and we can try and solve it. Better still, post the workbook.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location
    Quote Originally Posted by Bob Phillips View Post
    Show us the code that you tried Jacqui, and we can try and solve it. Better still, post the workbook.
    Attached is my workbook so far.
    I don't really need to display the row numbers in Column O, I was just playing around to see if I could find the relevant row numbers.
    Where I'm stuck is selecting the rows once I find them, and moving them up.
    Attached Files Attached Files

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    You can sort in Excel.

  5. #5
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location
    Quote Originally Posted by snb View Post
    You can sort in Excel.
    I cannot sort as the list has already been sorted from largest to smallest using another column's values.
    I just need to group like entities together.

  6. #6
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    To Excel, these would look like 2 different companies


    21692408 Growthpoint Properties Intern (Pty) Ltd
    21692408 Growthpoint Properties Intern (Pty) Ltd
    19399920 Growthpoint Properties Ltd

    How would Excel know to group them?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7
    VBAX Newbie
    Joined
    Jun 2020
    Posts
    4
    Location
    Quote Originally Posted by Paul_Hossler View Post
    To Excel, these would look like 2 different companies


    21692408 Growthpoint Properties Intern (Pty) Ltd
    21692408 Growthpoint Properties Intern (Pty) Ltd
    19399920 Growthpoint Properties Ltd

    How would Excel know to group them?

    By the word "Growthpoint." They are not the same entities but they are "like" entities. That's why I just want to search for the first part of the name "Growthpoint."

  8. #8
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    What is 'grouping' different from 'sorting' ?
    If you 'can't' sort, you 'can't' group.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •