PC Review


Reply
Thread Tools Rate Thread

Copy Contents From Worksheet to Another Worksheet

 
 
Dean P.
Guest
Posts: n/a
 
      6th Dec 2007

I have a spreadsheet with a worksheet named Team. I would like to clear all
of the rows except row 1 from Team_A worksheet each time the script is
executed. Next use the criterias listed below to copy the contents from Team
worksheet to Team_A worksheet.


Thanks so much for the help.

Team worksheet (Criteria to copy the row)
1. First record start in row 7.
2. Copy Columns A to Z
3. If record in Column K is greater than current day copy the record

 
Reply With Quote
 
 
 
 
OssieMac
Guest
Posts: n/a
 
      6th Dec 2007
Hi Dean,

This should do what you want.

Sub Copy_Data()
Dim wsA As Worksheet
Dim ws As Worksheet
Dim rowNumb As Long
Dim rngK As Range
Dim c As Range


Set wsA = Sheets("Team_A")
Set ws = Sheets("Team")

With wsA
rowNumb = .UsedRange.Rows.Count
.Range(.Rows(2), .Rows(rowNumb)).ClearContents
End With

With ws
Set rngK = .Range(.Cells(7, "K"), _
.Cells(.Rows.Count, "K").End(xlUp))
End With

For Each c In rngK
If c.Value > Date Then
Range(c.Offset(0, -10), c.Offset(0, 15)).copy _
Destination:=wsA.Cells(Rows.Count, "K") _
.End(xlUp).Offset(1, -10)
End If
Next c
End Sub

--
Regards,

OssieMac


"Dean P." wrote:

>
> I have a spreadsheet with a worksheet named Team. I would like to clear all
> of the rows except row 1 from Team_A worksheet each time the script is
> executed. Next use the criterias listed below to copy the contents from Team
> worksheet to Team_A worksheet.
>
>
> Thanks so much for the help.
>
> Team worksheet (Criteria to copy the row)
> 1. First record start in row 7.
> 2. Copy Columns A to Z
> 3. If record in Column K is greater than current day copy the record
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy an Excel worksheet with formulas and clear contents. Compeer buddy Microsoft Excel Misc 2 29th Jan 2008 05:21 PM
Worksheet.Copy() truncates cell contents problem Mark Hanley Microsoft Excel Programming 3 26th May 2007 02:51 PM
Formulas to copy contents of one cell in a worksheet to another ce =?Utf-8?B?Q29hY2h5?= Microsoft Excel Misc 1 11th Nov 2006 02:13 AM
how to copy cell contents from one workseet to another worksheet? =?Utf-8?B?SmFtZXM=?= Microsoft Excel Misc 1 21st Jan 2006 09:12 PM
Copy cell contents to another worksheet ndavies Microsoft Excel Programming 2 21st Jun 2004 10:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.