N
Neil Holden
Below is the code to export the data from 3 worksheets to an external sheet.
This works perfect, however i am going to be needing to alter this code on a
weekly basis as sheets are constantly being added.
The question i have is, can i make my own excel worksheet and allow the user
to type in the new name of the worksheet to export?
For example:
column A
EAM676
EAM788
EAM872
EAM338
When the button is pressed the data is exported to the external sheet?
Would love an answer to this and would be much appreciated.
Neil.
Dim wb1 As Workbook, wb2 As Workbook
Dim ws As Worksheet, lngRow As Long
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open("\\sguk-app1\Business Objects\CHR\Export of
SGUK.xls")
Set ws = wb2.Sheets("Sheet1")
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("EAM605").Range("A8:T27").Copy ws.Range("A" & lngRow)
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("EGC613").Range("A8:T27").Copy ws.Range("A" & lngRow)
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("ECP621").Range("A8:T27").Copy ws.Range("A" & lngRow)
wb2.Close True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
This works perfect, however i am going to be needing to alter this code on a
weekly basis as sheets are constantly being added.
The question i have is, can i make my own excel worksheet and allow the user
to type in the new name of the worksheet to export?
For example:
column A
EAM676
EAM788
EAM872
EAM338
When the button is pressed the data is exported to the external sheet?
Would love an answer to this and would be much appreciated.
Neil.
Dim wb1 As Workbook, wb2 As Workbook
Dim ws As Worksheet, lngRow As Long
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open("\\sguk-app1\Business Objects\CHR\Export of
SGUK.xls")
Set ws = wb2.Sheets("Sheet1")
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("EAM605").Range("A8:T27").Copy ws.Range("A" & lngRow)
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("EGC613").Range("A8:T27").Copy ws.Range("A" & lngRow)
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
wb1.Sheets("ECP621").Range("A8:T27").Copy ws.Range("A" & lngRow)
wb2.Close True
Application.DisplayAlerts = True
Application.ScreenUpdating = True