jsmith2094
New Member
- Joined
- Aug 19, 2021
- Messages
- 35
- Office Version
- 365
- Platform
- Windows
HI,
I have a spreadsheet which allows users to input data on Sheet1 and then when they press submit it transfers the data to a database sheet called Sheet2
that part works fine but I need to have a macro to check Sheet2 first to see if any of the data from Sheet 1 has already been submitted and if it has to display a message to say this data has already been submitted and then for the macro to stop as I have 2 other macros running.
this is what I have so far but it only displays a message if the user does not input anything, if the user inputs data it continues to run without a warning if the data is already on Sheet 2
also
On Sheet 1 the data is inputted into column D rows 13 to 16 but on the below macro if I want to check multiple cells such as FindWhat = Worksheets("Sheet1").Range("D13:D16").Value
it gives me a runtime error.
any suggestions?
I have a spreadsheet which allows users to input data on Sheet1 and then when they press submit it transfers the data to a database sheet called Sheet2
that part works fine but I need to have a macro to check Sheet2 first to see if any of the data from Sheet 1 has already been submitted and if it has to display a message to say this data has already been submitted and then for the macro to stop as I have 2 other macros running.
this is what I have so far but it only displays a message if the user does not input anything, if the user inputs data it continues to run without a warning if the data is already on Sheet 2
also
On Sheet 1 the data is inputted into column D rows 13 to 16 but on the below macro if I want to check multiple cells such as FindWhat = Worksheets("Sheet1").Range("D13:D16").Value
it gives me a runtime error.
VBA Code:
Sub Procedure1()
Dim FoundCell As Range
Dim FindWhat As String
FindWhat = Worksheets("Sheet1").Range("D13").Value
Set FoundCell = Worksheets("Sheet2").Range("A:A").Find(What:=FindWhat, LookAt:=xlWhole)
If Not FoundCell Is Nothing Then
MsgBox "Found " & FindWhat & " Data already Submitted to the Fraud Team!"
Exit Sub
End If
End Sub
any suggestions?