copying worksheet

S

Sylvia

In my earlier post I got this code for adding the content of th
specified excel sheet. But where as this code is directly copying th
worksheet and adding it to my current opened worksheet. But what I wan
to do is copy the data..and add it to my currently opened workshee
below the current data.

I dont know if i have explained it correctly or not. But here is th
code which i got for referance.


Sub testme()
Dim myFileName As Variant
Dim newwkbk As Workbook
Dim CurWks As Worksheet

myFileName = Application.GetOpenFilename("excel files, *.xls")
If myFileName = False Then
Exit Sub
End If

Set CurWks = ActiveSheet
Set newwkbk = Workbooks.Open(Filename:=myFileName)
newwkbk.Worksheets.Copy before:=CurWks
newwkbk.Close savechanges:=False

End Sub

Please help.
 
D

Dave Peterson

You have a followup at the original thread.
In my earlier post I got this code for adding the content of the
specified excel sheet. But where as this code is directly copying the
worksheet and adding it to my current opened worksheet. But what I want
to do is copy the data..and add it to my currently opened worksheet
below the current data.

I dont know if i have explained it correctly or not. But here is the
code which i got for referance.

Sub testme()
Dim myFileName As Variant
Dim newwkbk As Workbook
Dim CurWks As Worksheet

myFileName = Application.GetOpenFilename("excel files, *.xls")
If myFileName = False Then
Exit Sub
End If

Set CurWks = ActiveSheet
Set newwkbk = Workbooks.Open(Filename:=myFileName)
newwkbk.Worksheets.Copy before:=CurWks
newwkbk.Close savechanges:=False

End Sub

Please help..
 

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

Similar Threads


Top