ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select specific records (https://www.excelbanter.com/excel-programming/350824-select-specific-records.html)

Rob

select specific records
 
I want to select specific records that match a criteria in a column.
Basically I want to select records where the column has either an "e" or a
"b". No blanks. Can somebody help me?

Chip Pearson

select specific records
 
Try something like

Dim TotalRng As Range
Dim Rng As Range
For Each Rng In _
Application.Intersect(ActiveSheet.UsedRange,
ActiveSheet.Columns(1)).Cells
If Rng.Text = "e" Or Rng.Text = "b" Then
If TotalRng Is Nothing Then
Set TotalRng = Rng
Else
Set TotalRng = Application.Union(TotalRng, Rng)
End If
End If
Next Rng
TotalRng.Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"Rob" wrote in message
...
I want to select specific records that match a criteria in a
column.
Basically I want to select records where the column has either
an "e" or a
"b". No blanks. Can somebody help me?




Rob

select specific records
 
I don't think I need the intersect function. I am selecting cells from
Column "L" that are popultated with either an "e", or a "b". This gives me
an error away.

"Rob" wrote:

I want to select specific records that match a criteria in a column.
Basically I want to select records where the column has either an "e" or a
"b". No blanks. Can somebody help me?



All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com