search for a value in a range

RoseGuy

New Member
Joined
Dec 21, 2020
Messages
7
Office Version
  1. 2013
Platform
  1. Windows
Is there a way to search for a value that's in between a range of numbers and have it find the correct cell. For instance,

1608588544198.png


I want to be able to search for 51477 and have it highlight Column A4.
 

Attachments

  • 1608588500456.png
    1608588500456.png
    8.5 KB · Views: 8

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
I think you want

Excel Formula:
=MATCH(51477, A:A, 1) + 1

That will find the largest number less than or equal to 51477, then return the next number.

What do you mean by "search" and "highlight"? Do you mean you want conditional formatting?
 
Upvote 0
I want it to locate the cell in column A if possible. I give out thousand of sequentially numbered tags grouped in quantities of 100 listed in column A and B. When people bring unused tags back, I have to find the correct row and then I type in the number of the first unused (in Column C) but there are so many rows it’s hard to scroll quickly and find the correct row.
 
Upvote 0
This formula can be adapted to conditional formatting to highlight the cell with a fill color, but VBA could actually put your cursor in that cell so you don't have to scroll looking for it:

VBA Code:
Public Sub findit()

   Cells(Application.WorksheetFunction.Match(Range("C1"), Range("A:A"), 1) + 1, "C").Select

End Sub
 
Upvote 0
VBA code makes a cell active after user input in cell C2. Works great. I would like to now copy that input into the cell where the cursor is. That would be simple except the input and the active cell changes with every user input. Is there code to say whatever cell is active, copy and paste the current user input from C2?
 
Upvote 0
Thank you very much. That works for what I need.
@RoseGuy: Welcome to the MrExcel Message Board, and great to see you got the solution to your question!

Could you please mark the solution post that answers your question? Therefore, future visitors would know this question has a working solution.
 
Upvote 0

Forum statistics

Threads
1,215,237
Messages
6,123,807
Members
449,127
Latest member
Cyko

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