View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
holysoul[_4_] holysoul[_4_] is offline
external usenet poster
 
Posts: 1
Default Select a sheet to copy from one workbook to another

Hi everyone,

my problem is that I have to import ( copy) a sheet from another exce
file into the one I'm in right now (the one with my VBA code etc...)
copy it is OK but what i want to do is when the other workbook opens,
want the person who'll be using this program to be able to select th
sheet she wants to copy (because the compagny who supplys us the secon
file in which we go get the sheet, never places it at the same plac
AND there are 2 sheets almost identical... one of them being the one
want ).

So in simple, when the second workbook opens, would it be possible fo
the user to go click on the worksheet she wants, or anything similar t
that ...?

here is what i've got for now but it presumes that the sheet is alway
in the second position.

Sub ImporterFeuilleQSS()

Dim fichierQSS
Dim wkbk1 As Workbook
Dim wkbk2 As Workbook
Dim Wks As Worksheet

Application.ScreenUpdating = False


fichierQSS = Application.GetOpenFilename("Feuilles Excels (*.xls)
*.xls")
If fichierQSS < "Faux" Then
Application.Workbooks.Open (fichierQSS)
Else
Application.ScreenUpdating = True
Exit Sub
End If

Set wkbk1 = Workbooks(2)
Set wkbk2 = Workbooks("Conversion en Ascii.xls")


wkbk1.Worksheets(2).Cop
after:=wkbk2.Worksheets(wkbk2.Worksheets.Count)
Set Wks = ActiveSheet
Wks.Name = "Commande QTT"
Cells.EntireColumn.Hidden = False

Workbooks(2).Close (False)

Application.ScreenUpdating = True

End Sub


Thanks for anyone trying ...anything :p

Holysoul

--
Message posted from http://www.ExcelForum.com