Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Copy Contents From Worksheet to Another Worksheet


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Copy Contents From Worksheet to Another Worksheet

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
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
How to copy an Excel worksheet with formulas and clear contents. Compeer buddy Excel Discussion (Misc queries) 2 January 29th 08 05:21 PM
Copy Record to Appropriate Worksheet Based on Contents of Column A - VBA. Si[_2_] Excel Programming 7 February 2nd 07 07:33 AM
Formulas to copy contents of one cell in a worksheet to another ce Coachy Excel Discussion (Misc queries) 1 November 11th 06 02:13 AM
how to copy cell contents from one workseet to another worksheet? James Excel Discussion (Misc queries) 1 January 21st 06 09:12 PM
Copy cell contents to another worksheet ndavies Excel Programming 2 June 21st 04 10:06 PM


All times are GMT +1. The time now is 10:18 PM.

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"