View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
daisy2008 daisy2008 is offline
external usenet poster
 
Posts: 19
Default Coping a whole row to another sheet

Ryan

Thank you for trying to help me but I'm very new to code and I can not make
either one of these work. Is sheet 1 where the data is and if it finds family
in column b is it going to place it in sheet2 A1? The 2nd one i'm just
getting a subscript out of range error.

I was hoping if I asked in a clear question you would have all the info to
help me but as I'm new maybe I didn't ask right.

Maybe if you just help me move the rows I need to a sheet I can figure the
rest out?

Daisy :)



"ryguy7272" wrote:

Something like this (very generic code) should work for you
Sub newone()
Dim RngColF As Range
Dim i As Range
Dim Dest As Range
Sheets("Sheet1").Select
Set RngColF = Range("B1", Range("B" & Rows.count).End(xlUp))
With Sheets("Sheet2")
Set Dest = .Range("A1")
End With
For Each i In RngColF
If i.Value = "Family" Then
i.EntireRow.Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub

Obviously, change 'family' to the month you need, change the sheet names, etc.

You can experiment with this too...
Sub CopyData10()
Dim rng As Range, cell As Range
Dim rw As Long
Set rng = Worksheets("Copy Data3").Range("B1:B10")
rw = 1
For Each cell In rng
If LCase(cell.Value) = "x" Then
Worksheets("Copy Data4").Cells(rw, "A") = cell.Offset(0, -1)
rw = rw + 1
End If
Next
End Sub

Regards,
Ryan---

--
RyGuy


"daisy2008" wrote:

What would be the best way to creat a command button (on sheet "Report") that
will pull (from sheet "Report Data") only the month (colum AI) in which is
stated on sheet "Report" ActivCell F12. Insert the (whole row) results in a
new sheet at the end of the workbook or existing sheet "Monthly Report". Then
Hide colums D thru AE and AI, totaling Colums AF, AG and AH. Creating a
formual in a cell that will take the total in AH to see if it is over the
budget amount by dividing the annual budget number in sheet "Report" cell F10
by 12 then stating how much money is left for the year?