Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Sally
 
Posts: n/a
Default VBA HELP - DO UNTIL EMPTY ROW FOUND

Hi,
I am trying to search through rows of data & copy rows which contain an 'X'
in column L to another sheet - I have written the below code;
Dim row1
row1 = 4
Do Until Sheets("O_S DIV'S").Range("A" & row1).Value = Empty
If Sheets("O_S DIV'S").Range("L" & row1).Value = "X" Then
Sheets("O_S DIV'S").Range("A" & row1 & ":M" & row1).Copy
Sheets("Sheet1").Range("A" & row2).PasteSpecial xlPasteAll
row2 = row2 + 1
End If
row1 = row1 + 1

Loop
This code works however I also want to search for rows containing Y & Z in
the same column & also return these rows to the same sheet.
So I end up with all returned rows containing either an X, Y or Z to the
selected sheet
--
Thanks
Sally
  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default VBA HELP - DO UNTIL EMPTY ROW FOUND

If Sheets("O_S DIV'S").Range("L" & row1).Value = "X" Or _
Sheets("O_S DIV'S").Range("L" & row1).Value = "Y" Or _
Sheets("O_S DIV'S").Range("L" & row1).Value = "Z" Then


--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Sally" wrote in message
...
Hi,
I am trying to search through rows of data & copy rows which contain an

'X'
in column L to another sheet - I have written the below code;
Dim row1
row1 = 4
Do Until Sheets("O_S DIV'S").Range("A" & row1).Value = Empty
If Sheets("O_S DIV'S").Range("L" & row1).Value = "X" Then
Sheets("O_S DIV'S").Range("A" & row1 & ":M" & row1).Copy
Sheets("Sheet1").Range("A" & row2).PasteSpecial xlPasteAll
row2 = row2 + 1
End If
row1 = row1 + 1

Loop
This code works however I also want to search for rows containing Y & Z in
the same column & also return these rows to the same sheet.
So I end up with all returned rows containing either an X, Y or Z to the
selected sheet
--
Thanks
Sally



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
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
Need to Improve Code Copying/Pasting Between Workbooks David Excel Discussion (Misc queries) 1 January 6th 06 03:56 AM
Excel - Autom. Filter "Empty / Non Empty cells" should come first Rom Excel Discussion (Misc queries) 0 August 10th 05 04:32 PM
In Bar Chart, can we display both figures and their respective %a. Airtel Excel Discussion (Misc queries) 3 March 9th 05 02:35 PM
Empty Cells, Spaces, Cond Format? Ken Excel Discussion (Misc queries) 3 December 4th 04 04:47 PM


All times are GMT +1. The time now is 11:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"