extracting data from different excel sheets

  • Thread starter Thread starter catchchatur
  • Start date Start date
C

catchchatur

Dear Experts,

I want to extract data from different workbooks into target workbook.
I want to do it in following steps.

1. After clicking the command button, it should asks for the source
workbook
2. Once I browse and select the source workbook, it copies the data
based on the specified conditions and paste it into the target
workbook.

I would appcreciate of somebody can help me on this. If this stuff is
been discussed earlier, please send me the links. I couldn't locate
it as of now.

Thanks,
Chatur
 
Try this...

Private Sub CommandButton1_Click()
Dim FName As String, Ws As Worksheet, Wb As Workbook
Set Ws = ActiveSheet
FName = Application.GetOpenFilename( _
FileFilter:="Excel Files (*.xls), *.xls")

If FName <> "False" Then
Set Wb = Workbooks.Open(FName)
Else
Exit Sub
End If

Wb.Sheets(1).Range("A1").Copy Ws.Range("A1")
Wb.Close SaveChanges:=False

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top