+ Reply to Thread
Results 1 to 2 of 2

Userform VBA to stop sending duplicates across to mastersheet

  1. #1
    Registered User
    Join Date
    08-31-2013
    Location
    Glasgow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Userform VBA to stop sending duplicates across to mastersheet

    Hi All,

    I really hope someone can help.

    I have a userform that is sending data via a command button to columns B to J on my "mastersheet" (sheet1), I am looking for a helping hand in making sure that no duplicates are transferred across to the "mastersheet" (sheet 1), and will notify if this does happen.

    Please help me Excelforum, your my only hope.

    Thanks in advance

    Scott

  2. #2
    Registered User
    Join Date
    08-31-2013
    Location
    Glasgow
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Userform VBA to stop sending duplicates across to mastersheet

    Sorry all,

    I have the code below working perfect, but I need it stop sending across duplicate information, and let me know where on the Mastersheet the duplication has occurred. Thanks in advance.

    Private Sub cmdbutton_copy_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Mastersheet")


    'find first empty row in database
    iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
    SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1

    'check for a WorkplaceID number
    If Trim(Me.ComboBox_ComboBox1.Value) = "" Then
    Me.ComboBox_ComboBox1.SetFocus
    MsgBox "Please Scan Passport ID or Select From Workplace ID Dropdown List"
    Exit Sub
    End If

    'copy the data to the database
    ws.Cells(iRow, 1).Value = Me.ComboBox_ComboBox1.Value
    ws.Cells(iRow, 2).Value = Me.txtbox_OldPCSerial.Value
    ws.Cells(iRow, 3).Value = Me.txtbox_OldPCAsset.Value
    ws.Cells(iRow, 4).Value = Me.txtbox_OldMonitorSerial.Value
    ws.Cells(iRow, 5).Value = Me.txtbox_OldMonitorAsset.Value
    ws.Cells(iRow, 6).Value = Me.txtbox_NewPCName.Value
    ws.Cells(iRow, 7).Value = Me.txtbox_NewPCSerial.Value
    ws.Cells(iRow, 8).Value = Me.txtbox_NewPCAsset.Value
    ws.Cells(iRow, 9).Value = Me.txtbox_NewMonitorSerial.Value
    ws.Cells(iRow, 10).Value = Me.txtbox_NewMonitorAsset.Value
    ws.Cells(iRow, 11).Value = Me.txtbox_RoomNo.Value
    ws.Cells(iRow, 12).Value = Me.txtbox_PassportRoomNo.Value
    ws.Cells(iRow, 13).Value = Me.ComboBox_Designation.Value

    MsgBox "Data Added To Mastersheet", vbOKOnly + vbInformation, "Data Added to Mastersheet"
    'clear the data
    Me.ComboBox_ComboBox1.Value = ""
    Me.txtbox_OldPCSerial.Value = ""
    Me.txtbox_OldPCAsset.Value = ""
    Me.txtbox_OldMonitorSerial.Value = ""
    Me.txtbox_OldMonitorAsset.Value = ""
    Me.txtbox_NewPCName.Value = ""
    Me.txtbox_NewPCSerial.Value = ""
    Me.txtbox_NewPCAsset.Value = ""
    Me.txtbox_NewMonitorSerial.Value = ""
    Me.txtbox_NewMonitorAsset.Value = ""
    Me.txtbox_PassportRoomNo.Value = ""


    Me.ComboBox_ComboBox1.SetFocus
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Stop sending mail problem
    By mukeshbaviskar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-05-2013, 09:17 PM
  2. Marco Help to Stop duplicates
    By Jamesr571 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-16-2013, 10:44 AM
  3. Replies: 3
    Last Post: 06-05-2012, 09:05 PM
  4. VBA Userform sending incomplete data
    By Newport Count in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2010, 02:46 PM
  5. [SOLVED] Sending a parameter to a Userform
    By Dave Scott in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2006, 11:50 PM

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