duplicates

krupendra

New Member
Joined
Sep 9, 2011
Messages
4
Dear,

I have created one form using macro using text box, and command button as save,
The data is saving in excell sheet, but while saving i want one msg box if there is any duplicate entry is there please clarify

Thanks
krupendra
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Do you mean to say that you enter data in a textbox and hit the command button to save the data in the textbox to the excel file? While saving the data to excel file do you want to check for duplicates?

If that is correct, copy paste the macro you are using.
 
Upvote 0
dear,
This is the code used by me to save to excell, its working, but i want to know duplicates value if there in Wroksheet("Group").




Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GROUP")


'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a part number
If Trim(Me.txtgroup.Value) = "" Then
Me.txtgroup.SetFocus
MsgBox "PLEASE ENTER GROUP NAME", vbInformation

Exit Sub
End If

ANSWER = MsgBox("DO YOU WANT TO SAVE", vbYesNo)
If ANSWER = vbNo Then Exit Sub

'copy the data to the database
ws.Cells(iRow, 1).Value = ws.Cells(iRow - 1, 1).Value + 1
ws.Cells(iRow, 2).Value = Me.txtgroup.Value


'clear the data
Me.txtgroup.Value = ""



End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

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