Determining a Range within a Column using VBA

Tuffman

New Member
Joined
May 31, 2012
Messages
48
Office Version
  1. 2016
Platform
  1. Windows
I am trying to determine a range within a column of data that is smaller than the range of the entire column. In the example below, I have brand of vehicles in column A. How would I write the code to search column A and find the range for all of the Toyota vehicles?

Car Example.xlsx
A
1Ford
2Ford
3Ford
4Ford
5Ford
6Ford
7Ford
8Toyota
9Toyota
10Toyota
11Toyota
12Toyota
13Toyota
14Toyota
15Toyota
16Toyota
17Toyota
18Toyota
19Toyota
20Toyota
21Toyota
22Toyota
23Toyota
24Toyota
25GMC
26GMC
27GMC
28GMC
29GMC
30GMC
31GMC
Sheet1
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Code:
Sub Like_So()
    MsgBox Range(Columns(1).Find("Toyota", , , 1, , 1), Columns(1).Find("Toyota", , , 1, , 2)).Address
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,221,540
Messages
6,160,417
Members
451,644
Latest member
hglymph

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