Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Question 1
How to copy every 2 lines of data to a new sheet when the conditions meet. i.e. from sheet1 to sheet2. Sheet 1 holds the overall data and Sheet 2 will contains the filtered data only. The conditions are when cell value col2=5 and col38=178 in Sheet 1,the current row and the row below will be copy to Sheet 2. This will loop through Sheet 1 from top down. Question 2 How to delete all worksheets through VBA starting with name like Order1,Order2, .......until Order150 in one go, keeping only MasterOrder Sheet in the workbook. It is very tedious to delete manually. Thanks & Regards ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Question 2
drag the master sheet to be either the first sheet or the last sheet. Click on Order1 sheet tab. Hold down the shift key and click on Order50 sheet tab Do Edit=Delete Sheet. question 1 Dim rng as Range, cell as Range With Worksheets("Sheet1") Set rng = .Range(.cells(2,1),.cells(rows.count,1).End(xlup)( 0)) End With for each cell in rng if cell.offset(0,1)=5 and cell.offset(0,37)=178 then cell.resize(2,1).EntireRow.Copy Destination:= _ Worksheets("Sheet2").Cells(rows.count,1).End(xlup) (2) end if Next Assumes that the second row copied will not meet the condition. -- Regards, Tom Ogilvy "Michael168" wrote in message ... Question 1 How to copy every 2 lines of data to a new sheet when the conditions meet. i.e. from sheet1 to sheet2. Sheet 1 holds the overall data and Sheet 2 will contains the filtered data only. The conditions are when cell value col2=5 and col38=178 in Sheet 1,the current row and the row below will be copy to Sheet 2. This will loop through Sheet 1 from top down. Question 2 How to delete all worksheets through VBA starting with name like Order1,Order2, .......until Order150 in one go, keeping only MasterOrder Sheet in the workbook. It is very tedious to delete manually. Thanks & Regards ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Answers to questions posing more questions in a workbook | Excel Worksheet Functions | |||
2 VB Questions | Excel Worksheet Functions | |||
View Questions and Answer to questions I created | Excel Discussion (Misc queries) | |||
2 questions | Excel Discussion (Misc queries) | |||
Max / IF questions | Excel Discussion (Misc queries) |