ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   reading from another file and pasting to current file, "combobox" (https://www.excelbanter.com/new-users-excel/46708-reading-another-file-pasting-current-file-%22combobox%22.html)

Darius

reading from another file and pasting to current file, "combobox"
 
Can anybody please help me know how I can do this:
I have a file lets name it "result.xls" also I have lets say 100 files and
again suppose the names are "aa.xls", "bb.xls", ..., I want to put a combobox
in file, "result.xls" click on that I be able to see the names of those 100
files, then if I select one of them, this copy some data from various cells
in the source file and paste it to specific cells (e.g. B2:F4) in the
"result.xls" file.
Best
Darius

Mel Arquiza

Hi Darius,

See if this works for you. This is just an example.

'You need to have combobox, & picturebox.

Const PictDir As String = "C:\" 'change which drive and path you want.

Private Sub ComboBox1_Click()
With Me.ComboBox1
Image1.Picture = LoadPicture(PictDir & ComboBox1.Text)
End With
End Sub

Private Sub UserForm_Activate()
Dim F

F = Dir(PictDir & "*.jpg")

Do While Len(F) 0
With ComboBox1 'this loads the combo
.AddItem F
End With
F = Dir()
Loop

End Sub

"Darius" wrote:

Can anybody please help me know how I can do this:
I have a file lets name it "result.xls" also I have lets say 100 files and
again suppose the names are "aa.xls", "bb.xls", ..., I want to put a combobox
in file, "result.xls" click on that I be able to see the names of those 100
files, then if I select one of them, this copy some data from various cells
in the source file and paste it to specific cells (e.g. B2:F4) in the
"result.xls" file.
Best
Darius



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com