PDA

View Full Version : Using Find function in VBA



Jacqui
06-02-2020, 02:27 AM
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.

Bob Phillips
06-02-2020, 03:46 AM
Show us the code that you tried Jacqui, and we can try and solve it. Better still, post the workbook.

Jacqui
06-03-2020, 12:21 AM
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.

snb
06-03-2020, 05:59 AM
You can sort in Excel.

Jacqui
06-03-2020, 06:09 AM
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.

Paul_Hossler
06-03-2020, 06:50 AM
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?

Jacqui
06-04-2020, 01:31 AM
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."

snb
06-04-2020, 03:26 AM
What is 'grouping' different from 'sorting' ?
If you 'can't' sort, you 'can't' group.