Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to copy an Excel worksheet with formulas and clear contents. | Excel Discussion (Misc queries) | |||
Copy Record to Appropriate Worksheet Based on Contents of Column A - VBA. | Excel Programming | |||
Formulas to copy contents of one cell in a worksheet to another ce | Excel Discussion (Misc queries) | |||
how to copy cell contents from one workseet to another worksheet? | Excel Discussion (Misc queries) | |||
Copy cell contents to another worksheet | Excel Programming |