Pushing Separate info to separate sheets

  • Thread starter Dominique Feteau
  • Start date
D

Dominique Feteau

I have a worksheet that has 4 columns: Day, Date, Time, Yes or No.
What I want to do is on 2 other sheets, automatically push all the yes's
with corresponding time for all the "yes" rows and the same for the "no"
rows.

is there anyway to do that?
 
L

losmac

Insert new module into your workbook and paste code below:

Sub djskal()
GroupData "4", "5", "yes"
GroupData "4", "6", "no"
End Sub


Sub GroupData(srcSh As String, dstSh As String, sState As
String)
Dim i As Long, j As Long

i = 2
Do While Not IsEmpty(ThisWorkbook.Worksheets(srcSh).Range
("A" & i))
If ThisWorkbook.Worksheets(srcSh).Range("C" & i) =
sState Then
j = GetFirstEmpty(dstSh)
ThisWorkbook.Worksheets(dstSh).Range("A" & j) =
ThisWorkbook.Worksheets(srcSh).Range("A" & i)
ThisWorkbook.Worksheets(dstSh).Range("B" & j) =
ThisWorkbook.Worksheets(srcSh).Range("B" & i)
ThisWorkbook.Worksheets(dstSh).Range("C" & j) =
ThisWorkbook.Worksheets(srcSh).Range("C" & i)
End If
i = i + 1
Loop
End Sub


Function GetFirstEmpty(dstSh) As Long
Dim i As Long, j As Long

i = 2

Do While Not IsEmpty(ThisWorkbook.Worksheets(dstSh).Range
("A" & i))
i = i + 1
Loop

GetFirstEmpty = i

End Function
 
D

Dominique Feteau

to be more specific.
Day Date Time Successful
Fri 8/15/2003 10:24 AM Yes
Mon 8/18/2003 11:17 AM No
Tue 8/19/2003 10:23 AM Yes
Wed 8/20/2003

This is what my sheet looks like. I want to push the rows with the value of
"yes" in the successful column to pushed into another sheet. the same with
the rows with the value of "no".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top