+ Reply to Thread
Results 1 to 2 of 2

earlier post:copying worksheet

  1. #1
    Registered User
    Join Date
    01-10-2006
    Posts
    17

    Arrow earlier post:copying worksheet

    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..

  2. #2
    Dave Peterson
    Guest

    re: earlier post:copying worksheet

    You have a followup at the original thread.

    Sylvia wrote:
    >
    > 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..
    >
    > --
    > Sylvia
    > ------------------------------------------------------------------------
    > Sylvia's Profile: http://www.excelforum.com/member.php...o&userid=30300
    > View this thread: http://www.excelforum.com/showthread...hreadid=500995


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1