+ Reply to Thread
Results 1 to 5 of 5

Code problems: combo box - search list - if match - data insert

  1. #1
    Registered User
    Join Date
    02-13-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Code problems: combo box - search list - if match - data insert

    I am trying to create a UserForm to track campaigns. I would like to be able to enter the campaign ID name in a combo box (CB_ID) and then have it search a set row (D:D) and if the two match have the data inserted in that same row. I am having problems however writing the code in the section that is in bold below. Any suggestions?


    Private Sub ClearDataButton2_Click()

    Unload UserForm3
    UserForm3.Show
    UserForm3.CB_ActualLaunchDate.SetFocus

    End Sub

    Private Sub EnterDataButton2_enter()

    Dim NextRow As Integer
    Sheets("Campaigns").Activate
    Cells(NextRow, 8).FormulaR1C1 = "=R[-1]C+1"

    If CB_ID.Text = Application.WorksheetFunction.Search(CB_ID(Range("D:D"))) Then Cells(NextRow, 9) = CB_ActualLaunchDate.Text

    If OB_Sent Then Cells(NextRow, 13) = 1
    If OB_NotSent Then Cells(NextRow, 13) = 2

    Cells(NextRow, 14) = CB_SentOut.Value
    Cells(NextRow, 15) = CB_Opened.Value
    Cells(NextRow, 16) = CB_Clicked.Value

    End Sub

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code problems: combo box - search list - if match - data insert

    What exactly are you trying to do on that line?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-13-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Code problems: combo box - search list - if match - data insert

    I would like it to search within a column for the text entered in a combo box then if the two texts match then the data will be entered in the same row. Code is very very wrong tho.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code problems: combo box - search list - if match - data insert

    The worksheet function is used to search for a substring within a string, it won't search through multiple values.

    You probably want to use VBA's Find but I'm not sure what you are trying find.

  5. #5
    Registered User
    Join Date
    02-13-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Code problems: combo box - search list - if match - data insert

    Basically I have created one user form that inserts data pre-campaign and now i need a second form to enter data post campaign.
    The data consists primarily of text, values and dates.
    I would like the second form to be able to search/find the correct row to start inserting data on.
    I thought the easiest way to do this would be to search/ find based on the campaign name (text).

+ Reply to Thread

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