Joel
7/29/2009 4:40:00 PM
I fixed the row problem and the comma. the order can be changed to any order
you want. I gave just an example. Put in as many columns of data that you
want to move and the source and desttination column as required.
I don't know what column the dat is located so I can't help with filtering
the date automatically.
Sub DataMove()
Set SrcSht = Sheets("Sheet1")
Set DestSht = Sheets("Sheet2")
NewRow = 1
RowCount = 1
With SrcSht
Do While .Range("B" & RowCount) <> ""
Keyword = .Range("B" & RowCount)
If Keyword = "wood" Or _
Keyword = "stone" Or _
Keywood = "tile" Then
DestSht.Cells(NewRow, "H").Value = .Cells(RowCount, "A")
DestSht.Cells(NewRow, "J").Value = .Cells(RowCount, "B")
DestSht.Cells(NewRow, "K").Value = .Cells(RowCount, "C")
DestSht.Cells(NewRow, "G").Value = .Cells(RowCount, "D")
NewRow = NewRow + 1
End If
RowCount = RowCount + 1
Loop
End With
End Sub
"Jbm" wrote:
> Joel,
> Thanks for spending time helping me on this, it's much appreciated. I'm
> running into a few issues with your code though. Minorly, in case you try to
> test the code, note that there's an extra comma on New Row = New Row + 1.
> Onto the real troubles I'm having though. First, the code doesn't seem to
> want to grab the correct rows of Keywords with the "if Keyword" strings. For
> some reason the old "if c.Value Like" grabbed the right ones, but not these,
> so maybe we should use the old code on that? Another less pressing problem
> is that the new code is mixing up what order the data is in. I think I
> should have been more clear in the original description: columns A-E have
> data in them, A holds the date, B holds the name with the words we're
> searching for, and C-E have numerical data. The new code however is placing
> the data into columns in the order DA Blank BC, and E doesn't even show up.
> More important than these issues however is that the new code does pull
> specific dates, but not the ones we need. I used your code on a worksheet
> that goes up to 7/23/09, but the data pulled only consisted of dates 7/01/09
> to 7/03/09. For that sheet, for example, I am trying to get data only from
> 7/22/09.
>
> I guess I didn't realize how difficult this might be, and apologies if I
> wasn't clear at the start -- if you need more clarification to help, please
> just ask, any way I can help you, helps me. Thanks for the help again,
> though.