Hi there
I'm trying to post values from a multiselect listbox into columns 17 to 19, whilst also ensuring they are posted to the last row.
The bit in red I just cant work out
Any help appreciated
Thanks
Private Sub CmdCrea_Click()
Dim i As Integer, j As Integer
Dim ws As Worksheet
Dim lItem As Long
Set ws = Worksheets("Data")
ws.Activate
With ws
'position cursor in the correct cell A2.
Range("A2").Select
i = 1#
'check to see the next available blank row start at cell A2...
Do Until ActiveCell.Value = Empty
ActiveCell.Offset(1, 0).Select 'move down 1 row
i = i + 1 'keep a count of the ID for later use
Loop
'Populate the new data values into the worksheet.
ActiveCell.Value = i 'Next ID number
ActiveCell.Offset(0, 1).Value = Me.TxtURN.Text
ActiveCell.Offset(0, 2).Value = Me.TxtScop.Text
ActiveCell.Offset(0, 3).Value = Me.TxtArea.Text
ActiveCell.Offset(0, 4).Value = Me.TxtStra.Text
ActiveCell.Offset(0, 5).Value = Me.TxtRequ.Text
ActiveCell.Offset(0, 6).Value = Me.TxtRefi.Text
ActiveCell.Offset(0, 7).Value = Format(Now(), "MM/DD/YYYY")
For lItem = 0 To LstSyst.ListCount - 1
If Me.LstSyst.Selected(lItem) = True Then
Worksheets("Data Refined").Range("A:A").End(xlUp)(2, 17) = LstSyst.List(lItem)
Worksheets("Data Refined").Range("A:A").End(xlUp)(2, 18) = LstSyst.List(lItem)
Worksheets("Data Refined").Range("A:A").End(xlUp)(2, 19) = LstSyst.List(lItem)
Me.LstSyst.Selected(lItem) = False
End If
Next
Bookmarks