Macro to Find Cell Containing Certain Data

MikeeRDX

Board Regular
Joined
Feb 16, 2014
Messages
98
Hi, Is there a macro that will help me find a cell containing a certain data in a column of data? Much similar to how the Find Last Row or Find Empty Row macro works but instead, I would like to select an existing data from a drop down menu and have it find that data and bring it to view. Thank you in advance!
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,040
Office Version
  1. 365
Platform
  1. Windows
This code assumes the value being sought for is in cell A1 and the search is in column G. The code selects the cell that matches the search value, if no value is found, it does nothing :)

Code:
Sub finddate()
    On Error Resume Next
    Range("G1:G" & Range("G" & Rows.Count).End(xlUp).Row).Find(Cells(1, 1), Cells(1, "G")).Select
End Sub
 

MikeeRDX

Board Regular
Joined
Feb 16, 2014
Messages
98
HI....Thank you for your help. I plugged it in but it doesn't do anything. Here is how my data is setup. The value being sought is in cell K6. The column of data I'm trying to match the value with is in column "b" and it starts at B7. This is what I did from your instruction.

On Error Resume Next
Range("b7:b" & Range("b" & Rows.Count).End(xlUp).Row).Find(Cells(11, 6), Cells(11, "b")).Select
End Sub
 

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,040
Office Version
  1. 365
Platform
  1. Windows
Cell K6 should be
Code:
Cells(6,11)
not the other way round and B7 would be
Code:
 cells(7, "B")

SO
Code:
Sub finddate()    On Error Resume Next
    Range("B7:B" & Range("B" & Rows.Count).End(xlUp).Row).Find(Cells(6, 11), Cells(7, "B")).Select
End Sub
 

MikeeRDX

Board Regular
Joined
Feb 16, 2014
Messages
98
Thank you for your help. I believe I know what is wrong now and it due to the way my data is setup. You see, I currently have my data setup to full from another sheet. For example, the actual data is on Sheet1. But I need it to be copied (=if(sheet1!Q15>0,Sheet1!Q15," "). The original formula to copy over the data is what preventing the code to operate. I still need the setup in this manner because I'm using this sheet to input additional data. Is there a way to make this work given the current setup?
 

Watch MrExcel Video

Forum statistics

Threads
1,109,359
Messages
5,528,226
Members
409,809
Latest member
VICKRAM

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top