+ Reply to Thread
Results 1 to 2 of 2

Match and find entry

  1. #1
    Jennifer
    Guest

    Match and find entry

    I have a listbox in a userform the user makes his multiple selections, I need
    the macro to search the range database to find the matching row and place
    "Paid" in it there. The following code assumes:
    the entries in your listbox correspond to the rows of the range Database,
    but that isn't correct they don't correspond. So can anyone show me how to
    fix this. Tom said to record a macro using the EDIT>FIND method but i
    couldn't make that work. Thank you so much for you help!

    'Set sh = Worksheets("ProduceData")
    'Dim rng As Range
    'Set rng = sh.Range("Database").Columns(1).Cells
    'Dim i As Long
    'Dim rw As Long
    '
    'For i = 0 To lstData.ListCount - 1
    ' If lstData.Selected(i) Then
    ' rw = rng(i + 1).Row
    ' sh.Cells(rw, "ag").Value = "Paid"
    ' End If
    'Next
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer

  2. #2
    Bob Phillips
    Guest

    Re: Match and find entry

    Set sh = Worksheets("ProduceData")
    Dim rng As Range
    Set rng = sh.Range("Database").Columns(1).Cells
    Dim i As Long
    Dim rw As Long

    For i = 0 To lstData.ListCount - 1
    If lstData.Selected(i) Then
    Set rng = Nothig
    If Not rng Is Nothing Then rng.Value = "Paid"
    End If
    Next

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > I have a listbox in a userform the user makes his multiple selections, I

    need
    > the macro to search the range database to find the matching row and place
    > "Paid" in it there. The following code assumes:
    > the entries in your listbox correspond to the rows of the range Database,
    > but that isn't correct they don't correspond. So can anyone show me how

    to
    > fix this. Tom said to record a macro using the EDIT>FIND method but i
    > couldn't make that work. Thank you so much for you help!
    >
    > 'Set sh = Worksheets("ProduceData")
    > 'Dim rng As Range
    > 'Set rng = sh.Range("Database").Columns(1).Cells
    > 'Dim i As Long
    > 'Dim rw As Long
    > '
    > 'For i = 0 To lstData.ListCount - 1
    > ' If lstData.Selected(i) Then
    > ' rw = rng(i + 1).Row
    > ' sh.Cells(rw, "ag").Value = "Paid"
    > ' End If
    > 'Next
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer




+ 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