Originally Posted by
NomalAnomaly
Copy data from the workbook which name is unknown, to the workbook which name is known.
Okay, here is a very simple example. We could use a userform (see attached) with a listbox to list any other open workbooks.
The userform and code goes in the 'known' wb.
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim wb As Workbook
Set wb = Workbooks(lstOpenWBs.Value)
'do whatever copying
wb.Worksheets(1).Copy _
After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim wb As Workbook
cmdOK.Enabled = False
If Workbooks.Count > 1 Then
For Each wb In Workbooks
If Not wb.Name = ThisWorkbook.Name Then
lstOpenWBs.AddItem wb.Name
End If
Next
lstOpenWBs.ListIndex = 0
cmdOK.Enabled = True
Else
Me.Caption = "No Other Workbooks Open!"
End If
End Sub
Hope that helps,
Mark