VBA code to find ranges

mrpman97

Board Regular
Joined
Apr 11, 2007
Messages
56
I am trying to write code to find ranges.
Sample data:
CLP 32 21
32
323
32

CLP 54
534
hg
555

CLP
32
23

I want to identify all rows below any CLP starting row and before next CLP. I put space inbetween to empahsis what I am looking for. I can identify the row number which has a CLP but I do not know how to store these numbers. Even better would be to identify ranges of rows below each CLP and before the next CLP. Once I have a range identified I want to eliminate any duplicate rows for that section.
Code so far just identifies rows which CLP

For i = 1 to 100
If cells(i,1) like "*CLP*" then
msgbox "Row is " i
end if
next i
end sub

I need to store row numbers and or get ranges for each of subsets.
Need help
Thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,224,525
Messages
6,179,317
Members
452,905
Latest member
deadwings

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top