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!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,142
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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,142
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
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?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,014
Messages
5,856,831
Members
431,836
Latest member
jj0911

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
Top