There’s a fundamental flaw in my code which about 4,000 people will find in a flash!
I have a list of names in the range, OSFI1, on the sheet OSFIList.
I want to look for those names in the range of cells, EzenetData on the sheet Ezenet.
If a name is found, I want the row containing the found name (on the Ezenet sheet) to be shaded.
Help. please.
Ross
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Finding values (Excel2000)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Finding values (Excel2000)
- This topic has 20 replies, 5 voices, and was last updated 21 years, 6 months ago.
AuthorTopicWSRConnell
AskWoody LoungerDecember 18, 2003 at 12:20 pm #398158Viewing 5 reply threadsAuthorReplies-
WSHansV
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSRConnell
AskWoody Lounger -
WSsdckapr
AskWoody LoungerDecember 18, 2003 at 1:20 pm #759151Is this what you are after?
Steve
Dim OSFI1 As Range Dim EzenetData As Range Dim cell As Range Dim c Dim numrows As Long Sheets("Ezenet").Activate Set EzenetData = Range("B2").CurrentRegion Sheets("OSFIList").Activate numrows = Range("A1").CurrentRegion.Rows.Count Set OSFI1 = Range("B2").Resize(numrows + 1, 1) For Each cell In OSFI1 With EzenetData Set c = .Find(What:=cell.Value, LookIn:=xlValues) If Not c Is Nothing Then With c.Rows.EntireRow.Interior .ColorIndex = 35 .Pattern = xlSolid End With Set c = .FindNext© End If End With Next cell
-
WSRConnell
AskWoody Lounger -
WSsdckapr
AskWoody LoungerDecember 18, 2003 at 2:17 pm #759173One thing I failed to mention this line:
Set OSFI1 = Range(“B2”).Resize(numrows + 1, 1)Mimics what you did, since I was not entirely sure of your goal and how the data was set up. The range you set up is 2 rows longer than the last row in the “current region” (ie if the current region is A1:C100, you would “set” B2:B102 since your “offset”100 rows from B2. If you only meant to select B2:B100 then use:
Set OSFI1 = Range(“B2”).Resize(numrows – 1, 1)
Steve
-
WSRConnell
AskWoody Lounger -
WSRConnell
AskWoody Lounger -
WSsdckapr
AskWoody LoungerDecember 18, 2003 at 2:17 pm #759174One thing I failed to mention this line:
Set OSFI1 = Range(“B2”).Resize(numrows + 1, 1)Mimics what you did, since I was not entirely sure of your goal and how the data was set up. The range you set up is 2 rows longer than the last row in the “current region” (ie if the current region is A1:C100, you would “set” B2:B102 since your “offset”100 rows from B2. If you only meant to select B2:B100 then use:
Set OSFI1 = Range(“B2”).Resize(numrows – 1, 1)
Steve
-
-
WSRConnell
AskWoody Lounger
-
-
WSsdckapr
AskWoody LoungerDecember 18, 2003 at 1:20 pm #759152Is this what you are after?
Steve
Dim OSFI1 As Range Dim EzenetData As Range Dim cell As Range Dim c Dim numrows As Long Sheets("Ezenet").Activate Set EzenetData = Range("B2").CurrentRegion Sheets("OSFIList").Activate numrows = Range("A1").CurrentRegion.Rows.Count Set OSFI1 = Range("B2").Resize(numrows + 1, 1) For Each cell In OSFI1 With EzenetData Set c = .Find(What:=cell.Value, LookIn:=xlValues) If Not c Is Nothing Then With c.Rows.EntireRow.Interior .ColorIndex = 35 .Pattern = xlSolid End With Set c = .FindNext© End If End With Next cell
-
-
WSRConnell
AskWoody Lounger
-
-
WSAlanMiller
AskWoody LoungerDecember 18, 2003 at 2:40 pm #759159I see Steve has beaten me on the draw… surprise, surprise!
But here’s something that seems to do what you’re after, using 2 named ranges rng1 & rng2 in the same workbook.Alan
Edited – I have amended this code so that it now correctly (I hope) searches the second range for duplicate entries.
-
WSAlanMiller
AskWoody LoungerDecember 18, 2003 at 2:40 pm #759160I see Steve has beaten me on the draw… surprise, surprise!
But here’s something that seems to do what you’re after, using 2 named ranges rng1 & rng2 in the same workbook.Alan
Edited – I have amended this code so that it now correctly (I hope) searches the second range for duplicate entries.
-
macropod
AskWoody_MVPDecember 19, 2003 at 12:27 am #759392Hi Ross,
Just a thought: If you’re using named ranges, it should be quite easy to achieve the same result using conditional formatting, without the need to resort to vba. Although conditional formatting might noticeably slow down a large workbook, you wouldn’t need to remember to run a macro and conditional formatting would probably work faster than the macro anyway.
Cheers
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSsdckapr
AskWoody LoungerDecember 19, 2003 at 12:36 am #759394Conditional formatting would probably be faster.
I have been assuming that his code would eventually delete the rows and he was only highlighting the rows that he wanted to delete. I use this trick alot when I step thru code to make sure if does what I want without actually deleting it.
But perhaps I was jumping to conclusions.
Steve
-
WSRConnell
AskWoody LoungerDecember 19, 2003 at 11:37 am #759524 -
WSRConnell
AskWoody LoungerDecember 19, 2003 at 11:37 am #759525
-
-
WSsdckapr
AskWoody LoungerDecember 19, 2003 at 12:36 am #759395Conditional formatting would probably be faster.
I have been assuming that his code would eventually delete the rows and he was only highlighting the rows that he wanted to delete. I use this trick alot when I step thru code to make sure if does what I want without actually deleting it.
But perhaps I was jumping to conclusions.
Steve
-
-
macropod
AskWoody_MVPDecember 19, 2003 at 12:27 am #759393Hi Ross,
Just a thought: If you’re using named ranges, it should be quite easy to achieve the same result using conditional formatting, without the need to resort to vba. Although conditional formatting might noticeably slow down a large workbook, you wouldn’t need to remember to run a macro and conditional formatting would probably work faster than the macro anyway.
Cheers
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Viewing 5 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
21 minutes ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
1 hour, 40 minutes ago -
Is your battery draining?
by
Susan Bradley
1 hour, 4 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
3 hours, 37 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
4 hours, 13 minutes ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
7 hours, 28 minutes ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
10 hours, 24 minutes ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
42 minutes ago -
National scam day
by
Susan Bradley
3 hours, 38 minutes ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
53 minutes ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
1 day, 5 hours ago -
Tools to support internet discussions
by
Kathy Stevens
1 day, 12 hours ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
20 hours, 22 minutes ago -
AI is good sometimes
by
Susan Bradley
1 day, 12 hours ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
1 day, 2 hours ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
2 days, 12 hours ago -
June KB5060842 update broke DHCP server service
by
Alex5723
2 days, 11 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
2 days, 15 hours ago -
Excessive security alerts
by
WSSebastian42
1 day, 6 hours ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
3 days ago -
Ben’s excellent adventure with Linux
by
Ben Myers
17 hours, 56 minutes ago -
Seconds are back in Windows 10!
by
Susan Bradley
2 days, 11 hours ago -
WebBrowserPassView — Take inventory of your stored passwords
by
Deanna McElveen
1 day, 5 hours ago -
OS news from WWDC 2025
by
Will Fastie
15 hours, 40 minutes ago -
Need help with graphics…
by
WSBatBytes
1 day, 20 hours ago -
AMD : Out of Bounds (OOB) read vulnerability in TPM 2.0 CVE-2025-2884
by
Alex5723
3 days, 16 hours ago -
Totally remove or disable BitLocker
by
CWBillow
2 days, 15 hours ago -
Windows 10 gets 6 years of ESU?
by
n0ads
2 days, 18 hours ago -
Apple, Google stores still offer China-based VPNs, report says
by
Nibbled To Death By Ducks
4 days, 3 hours ago -
Search Forums only bring up my posts?
by
Deo
7 hours, 56 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.