LizCorbert
New Member
- Joined
- Oct 29, 2014
- Messages
- 25
I finally resolved prior issues regarding having selected items from a multiselect listbox recognize the defined arrays. However, now I am faced with a new issue, now the results from the selected arrays do not generate a new workbook. Now the results are generated in the workbook containing the macro. When the selections are changed the results do change, however, the magic occurs within the workbook containing the macro instead of producing a new workbook. Can someone please help me to re-establish that the results will generate new workbooks. PLEASE! See revised code.
Dim I As Long
Dim A As Long
A = Me.Submissionlist.Selected(0) & (1)
Dim selCount As Long
selCount = -1
Dim wbNew As Workbook
Set wbNew = ActiveWorkbook.Workbooks
For I = 0 To Me.Submissionlist.ListCount - 1
If Me.Submissionlist.Selected(I) Then
Sheets("SubmissionProperty").Visible = False
ThisWorkbook.Worksheets(Array("Client_Profile" & "SubmissionProperty")).Copy
Sheets("SubmissionProperty").Visible = True
Worksheets("Client_Profile").Move Before:=Worksheets(1)
Worksheets("Client_Profile").Activate
End If
If selCount = -1 Then
Me.Submissionlist.Selected(I) = False
Me.Submissionlist.Clear
End If
Exit For
Next
If Me.Submissionlist.Selected(1) Then
Sheets("SubmissionLiabilty").Visible = False
ThisWorkbook.Worksheets(Array("Client_Profile" & "SubmissionLiabilty")).Copy
Sheets("SubmissionLiabilty").Visible = True
Worksheets("Client_Profile").Move Before:=Worksheets(1)
Worksheets("Client_Profile").Activate
End If
If selCount = -1 Then
Me.Submissionlist.Selected(1) = False
Me.Submissionlist.Clear
End If
If Me.Submissionlist.Selected(A) Then
Sheets("SubmissionProperty").Visible = False
Sheets("SubmissionLiabilty").Visible = False
ThisWorkbook.Worksheets(Array("Client_Profile" & "SubmissionProperty" & "SubmissionLiabilty")).Copy
Sheets("SubmissionProperty").Visible = True
Sheets("SubmissionLiabilty").Visible = True
Worksheets("Client_Profile").Move Before:=Worksheets(1)
Worksheets("Client_Profile").Activate
End If
If selCount = -1 Then
Me.Submissionlist.Selected(A) = False
Me.Submissionlist.Clear
End If
If Me.Submissionlist.Value Then Unload Me
Application.ScreenUpdating = True
End Sub