ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select a sheet to copy from one workbook to another (https://www.excelbanter.com/excel-programming/300433-select-sheet-copy-one-workbook-another.html)

holysoul[_4_]

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


Don Guillett[_4_]

Select a sheet to copy from one workbook to another
 
How about instead of worksheets(2) using activeworksheet

--
Don Guillett
SalesAid Software

"holysoul " wrote in message
...
Hi everyone,

my problem is that I have to import ( copy) a sheet from another excel
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, i
want the person who'll be using this program to be able to select the
sheet she wants to copy (because the compagny who supplys us the second
file in which we go get the sheet, never places it at the same place
AND there are 2 sheets almost identical... one of them being the one I
want ).

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

here is what i've got for now but it presumes that the sheet is always
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).Copy
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/




holysoul[_5_]

Select a sheet to copy from one workbook to another
 
could be good, but how do i pause my code so that i can go select whic
sheet i want and then make it resume to take the activesheet (beein
the one I selected)

Find this, and you'll be my new God!

Holysou

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



All times are GMT +1. The time now is 08:49 PM.

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