Copy worksheet from one workbook to another

geospatial

Active Member
Joined
Sep 2, 2008
Messages
290
So far I have the following code:

Code:
Dim folderPath as String
Dim fileName as String
 
Sub master()
application.displayalerts = False
application.screenupdating = False
 
Dim wb as Workbook
 
folderPath = "C:\excel\"
fileName = "Dir(folderPath & "*.xls")
 
Call clear_sigmaster
 
Do While fileName <> ""
   Set wb = Workbooks.Open(folderPath & fileName)
 
Call sig_transfer
 
fileName = Dir()
 
Loop
 
End Sub
 
sub clear_sigmaster()
sheets("Sig_master").Select
Range("A2:EQ62000").Select
Selection.Delete shift:=xlUp
End Sub
 
Sub sig_transfer()
 
Windows(fileName).Activate
Sheets("MainReport").select
Rows("1:1").Select
selection.delete shift:=xlup
Range(Range("EP65536").End(xlup), "A1").select
Selection.Copy
Windows("Sig_Afg2011.xlsm").Activate
Sheets ("Paste_Here").Select
Range("A1").select
activesheet.paste
range("A1").Select
windows(filename).Activate
activeWindow.close
sheets("paste_here")
Range("A1").select
Range(Range("EQ65536").End(clup, "A1").Copy Sheets("Sig_master").range("A65536") _
.end(xlup).Offset(1,0)
Sheets("Paste_Here").Cells.Clear
End Sub

The problem I am having is that not all the data is coming over. I am thinking it is because "EQ" does not always have data. What I am needing I guess is the option to use xlUp on A1 and then copy over to EQ.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top