LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default copy and paste problem in vb

I have a sheet called DrListWorkCopy which data i would like to duplicate in
DrListWorkCopy1. DrLIstWorkCopy1 exists as an empty sheet with headers on row
1 identical to DrLIstWorkCopy. The Macro works well when there is data in
DrListWorkCopy. However, in the occasion when DrListWorkCopy happen to have
no data in it, the macro coppies the headers and paste it onto
DrListWorkCopy1.

How do I prevent that? I think it has got to do with how I coded the last
empty row in DrListWorkCopy1.

The codes are as follows:

Dim SourceWks As Worksheet
Dim TargetWks As Worksheet

Set SourceWks = Sheets("DrListWorkCopy")
Set TargetWks = Sheets("DrListWorkCopy1")

SourceWks.Range("A2:AS" & SourceWks.Range("AS65536").End(xlUp).Row).Copy
TargetWks.Select
Range("A2").Select
TargetWks.Paste

Would appreciate some help.
 
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
Copy Paste problem Ian_Add Excel Discussion (Misc queries) 3 January 11th 08 02:47 PM
Copy and paste problem Germano Excel Discussion (Misc queries) 1 August 24th 07 12:45 PM
Copy and Paste Problem Skc Excel Discussion (Misc queries) 1 March 8th 06 07:21 PM
copy paste problem? Neil22 Excel Discussion (Misc queries) 5 January 10th 06 05:32 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM


All times are GMT +1. The time now is 03:17 AM.

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

About Us

"It's about Microsoft Excel"