Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2 Questions ?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 2 Questions ?

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
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
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
2 VB Questions JRD-CFW[_2_] Excel Worksheet Functions 2 October 7th 08 12:31 AM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
2 questions the_dr38 Excel Discussion (Misc queries) 2 April 4th 06 12:12 PM
Max / IF questions G Excel Discussion (Misc queries) 1 October 12th 05 03:27 AM


All times are GMT +1. The time now is 12:13 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"