macro help

  • Thread starter Thread starter Roy Gudgeon
  • Start date Start date
R

Roy Gudgeon

I have 2 workbooks (Wb1 & WB2)
weekly I need to delete the database held in WB1, copy the database in WB2
and then paste into WB1. The database in WB2 is a hidden worksheet.

Its a fairly simple operation to copy and paste manually. However I want to
run a macro to carry out this procedure. I can record the macro however no
matter which way I try it will not paste the information, instead it pastes
the data from the first (and only unhidden worksheet ) in WB2.

If I do it manually there is no problem so why a problem following exactly
the same procedures in a macro ? Is the hiding operation causing a problem ?

Any help much appreaciated.
 
Something like this should do it...

'/===================
Dim Wb2bCopies As Workbook
Dim Wks_Hidden As Worksheet

Set Wb2bCopies = Workbooks("WB2.xls")
Set Wks_Hidden = Wb2bCopies.Worksheets("MyHiddenWorksheet")

Wks_Hidden.Range("A1:N20").Copy
ActiveSheet.Paste

Set Wks_Hidden = Nothing
Set Wb2 = Nothing
'/===================
 
Back
Top