gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
This code is giving me an error on:
Sheets("3 Source Selection").Range("B16").Activate
Thanks for the help!
Sheets("3 Source Selection").Range("B16").Activate
Code:
Private Sub CommandButton1_Click()
'**********************
'First Clear table
With Sheets("Selected Tasks").ListObjects("Selected_Tasks")
'Check If any data exists in the table
If Not .DataBodyRange Is Nothing Then
'Clear Content from the table
.DataBodyRange.ClearContents
End If
End With
'***********************
ListBox3.MultiSelect = fmMultiSelectMulti
'Loop through every item in the ListBox
For i = 0 To ListBox3.ListCount - 1
'Check if the item was selected.
If ListBox3.Selected(i) Then
'If here, means this item has been selected.
'Put all selected items in Column B
With Sheets("Selected Tasks")
If Len(.Range("A2").Value) = 0 Then
.Range("A2").Value = ListBox3.List(i, 11)
Else
.Range("A" & .Rows.Count).End(xlUp).Offset(1).Value = ListBox3.List(i, 11)
End If
End With
End If
Next i
UserForm3.Hide
MsgBox "Select the row that has the Cost Source that you would like to use for this part and its identified task(s)"
Sheets("3 Source Selection").Range("B16").Activate
End Sub
Thanks for the help!