Here is some code. It looks for t in Column F. It copies the found rows to a
new workbook...
Sub CopyRows()
Dim wks As Worksheet
Dim wbkNew As Workbook
Dim rngFound As Range
Dim rngFirst As Range
Dim rngFoundAll As Range
Dim rngToSearch As Range
Set wks = Sheets("Sheet1") 'Change This
Set rngToSearch = wks.Columns("F") 'Change This
Set rngFound = rngToSearch.Find(What:="t", LookAt:=xlWhole)
If rngFound Is Nothing Then
MsgBox "Sorry Nothing to Move"
Else
Set rngFoundAll = rngFound.EntireRow
Set rngFirst = rngFound
Do
Set rngFoundAll = Union(rngFoundAll, rngFound.EntireRow)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = rngFirst.Address
Set wbkNew = Workbooks.Add
rngFoundAll.Copy wbkNew.Sheets(1).Range("A2")
End If
End Sub
--
HTH...
Jim Thomlinson
"Rekanix" wrote:
Hello. I am a new user, and I'm thankful for this fantastic resource!
I wonder if anyone could offer some help? I'm trying to learn how to
copy an entire row to a different workbook if that row has a certain
value.
Specifically, I have a checkbook register, and I've added a column in
the register that, if I type something in that cell ("t" for tax
deductible item), then it will copy that entire row (date, check
number, pay to, amount, etc., etc.) to another workbook. Once the
information is copied to this separate workbook, I'll then have a copy
of all tax-deductible items for the year.
It has to be a separate workbook, because I'll have several budgets
(each month). So therefore, I need to copy the information from all
the budgets (as I create and make new each month) into the one
workbook. Can someone help? Thanks in advance!
--
Rekanix
------------------------------------------------------------------------
Rekanix's Profile: http://www.excelforum.com/member.php...o&userid=29586
View this thread: http://www.excelforum.com/showthread...hreadid=492857