#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default macro help

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.
--
thanks
Roy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 126
Default macro help

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
'/===================

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Roy Gudgeon" wrote:

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.
--
thanks
Roy

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default macro help

Thanks Gary

Modified the code a little and runs no problem.

i'm learning slowly !
--
thanks
Roy


"Gary Brown" wrote:

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
'/===================

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Roy Gudgeon" wrote:

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.
--
thanks
Roy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"