Search column for date

dualhcsniatpac

Board Regular
Joined
Feb 18, 2009
Messages
126
Im sorry if this is a repeat. I have searched and could not come up with anything close to adapt to my scenario.

I have a form that contains daily volumes. These will be entered in 1 time per day. What I would like, to prevent duplicate entries, is to (upon user submitting the volumes) first have the vba code check to see if there is already a date.

User submits volume data --> code checks to see if volume data is already entered in for that day.

If there is no date, then just enter the data like normal. If there is, I would like a textbox saying that there is already volume data for that day, would you like to overwrite or save old data.

I think I might be able to figure it out but I do not know how to dynamically search a row for something.

Thanks in advance.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
This code searches Column A (well a range) for Todays Date.

Code:
Sub FindDate()

On Error GoTo errorhandler:

Dim rng As Range
Set rng = Range("A1:A100")

today = Date


X = rng.Find(today)
MsgBox "Volume has already been added for day"
Exit Sub

errorhandler:

MsgBox "Your code here"


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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