Find specific cell using VBA

thomasbeard

Board Regular
Joined
Oct 19, 2005
Messages
139
I have a table in Excel which has dates across the top and categories along the left. I am creating a form in which you can specify your category and date and enter some text in a text box and when you click ok, a macro will find the correct cell on the table (using the date and category values) and copy the text. Has anyone got any code that will do this?
Thanks in advance
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Someting like this..

MyDate = DateValue("07/18/08")
MyCat = "Category"

x = Application.Match(MyCat,Range("A1:A1000"),0)
y = Application.Match(Cdbl(MyDate),Range("A1:Z1"),0)

MyResult = Cells(x,y).Value

Hope that helps...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

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