Posts by Virgil90

    I'll take a look tomorrow, I'm finishing for today.

    In addition, this sample is of the same one I was referring to in my other thread I posted here where you responded about the listbox.


    I wanted to return all empty fields from the actions column (because the action is outstanding, so remains empty) and the search criteria would be between dates with two boxes adjacent to each other in a combo/listbox and the results showing the Reference the blank cells belong to, the employee and the month too.


    Userform search to return empty cells - Thread

    Thanks Roy just saw you reply as I was writing my own.


    I have looked through the forum for similar posts and found a code that does identify the duplicate with a msgBox.


    ~ Earlier post should have said *ReftxtBox not NameTextBox


    This code has been preventing the entry being added to the worksheet at the time the user clicks submit on the form.

    Code
    If WorksheetFunction.CountIf(Worksheet("Admin").Columns(3), ReftxtBox) > 0 Then
        MsgBox ReftxtBox.value & " Already exists"
        Exit Sub
    End If

    This has caused an issue which I have not been able to replicate. I will try again and reply back if it continues.

    Thanks Roy,


    I have stopped replying to those threads as a direct result and will remain strictly here.


    I have attached a sample as per request.

    Try this

    Code
    If Application.WorksheetFunction.CountIf(Worksheets("Admin").Columns(3), Me.NameTextBox) > 1 Then MsgBox "Entry already exists.", vbCritical
    Exit Sub

    I've just noticed you don't use

    Code
    Application.WorksheetFunction

    That might be your problem

    Hi Roy,


    That didn't work unfortunately. I typed out the exact code, which continued with the next set of code and msgbox to say entry is added (regardless if it was a duplicate/unique ref) ...but also strangely, did not add it to the spreadsheet either.


    I have also tried adding Not before the original codes IsError

    Hi,


    Apologies - I may be pointing the obvious, but I am learning as I work


    I have used the code below to look from duplicate entries in a sheet when a user attempts to add the value in the text box from a USerForm.


    I found this code after a lot of searching online, but instead it is telling me everything I enter in the UserForm text box is a duplicate.


    I can post the rest of the code if that helps - maybe I placed the function in the wrong place within the entire code


    Thank you!

    Code
    If IsError (Application.Match (Me.NameTextBox, Worksheets("Admin").Columns(3),0)) Then
    MsgBox "Entry  already exists.", vbCritical
    Exit Sub
    End If

    Hi,


    I need help with a vba code for a search userform that will return blank cells from a specific column depending on the search criteria, which is between months period (format mmmm/yyyy).


    Columns in the spreadsheet should return the following:


    Column C "Reference", Column E "Type" and Column W "Actions". (Not sure if display column W is necessary seeing as it is blank)


    Column W named "Actions" is where I need to find if cells are blank and check what reference and type it belongs to.


    Userform design is basic:


    Month "combo box" Month "combo box"


    "Text box" This I'm thinking will show the search results


    "Search button" "Exit button"


    I hope I've managed to explain that properly. I'm just really struggling with this one!