Results 1 to 12 of 12

Modify code to show message box on duplicate entry

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-10-2008
    Location
    UK
    Posts
    220

    Modify code to show message box on duplicate entry

    Hi everyone.. i am using the following code to enter data into a worksheet. I would like to make it so if the data being entered in textbox1 is already present in columnA of the worksheet then a message box will appear stating so, and none of the data from the form is entered onto the sheet.

    Option Explicit
    Private Sub CommandButton1_Click()
        Dim LR As Long
        With Sheets("Master")
            LR = .Range("A" & .Rows.Count).End(xlUp).Row
            If LR <> 1 Then LR = LR + 1
            .Range("A" & LR).Value = Me.TextBox1
            .Range("B" & LR).Value = Me.TextBox2
            .Range("C" & LR).Value = Me.TextBox3
            .Range("D" & LR).Value = Me.TextBox4
            .Range("A" & LR).Offset(19, 0).Value = "ENTRY"
        End With
        Unload Me
    End Sub
    Last edited by twofootgiant; 06-14-2011 at 09:42 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1