PDA

View Full Version : Solved: Copy Entire Row based on Cell



kilbey1
09-26-2008, 07:20 PM
If I run the following code, it copies over the required data, but only from column F:


With ThisWorkbook
ReDim SheetWiseMax(1 To .Sheets.Count)
For i = 1 To .Sheets.Count
If Not Sheets(i).Name = "Release 3.0" Or Not Sheets(i).Name = "New Issues" Or Not Sheets(i).Name = "Closed" Or Not Sheets(i).Name = "Deferred" Then
For Each cell In Sheets(i).Range("F:F")
If UCase(cell.Value) = "Y" Then
cell.Resize(, 12).Copy Sheets("HOT").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next cell
End If
Next i
End With


I'd like to grab the entire row, starting from column A. I've tried some different things, but I either get errors or nothing copied. I understand that I've set the range to F:F; my goal is to have it check the value in column F set to "Y", and if so, grab that row and copy it over.

RonMcK
09-26-2008, 09:23 PM
What happens if you use the full width of the table and test the value in the cell for column F (column 6)?

xld
09-27-2008, 02:56 AM
With ThisWorkbook
ReDim SheetWiseMax(1 To .Sheets.Count)
For i = 1 To .Sheets.Count
If Not Sheets(i).Name = "Release 3.0" Or Not Sheets(i).Name = "New Issues" Or Not Sheets(i).Name = "Closed" Or Not Sheets(i).Name = "Deferred" Then
For Each cell In Sheets(i).Range("F:F")
If UCase(cell.Value) = "Y" Then
cell.Entirerow.Copy Sheets("HOT").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next cell
End If
Next i
End With

kilbey1
09-27-2008, 10:56 AM
cell.entirerow.copy worked. Can you tell I don't know VBA? :) And this after I looked all over for a good reference to the types of parameters the cell object could take.

Is there a good reference that would tell me what commands are applicable to various objects, like cell?

xld
09-27-2008, 12:48 PM
cell isn't an object, it is a variable that you point at a range obje. Help will give you the properties and methods of an object, such as range.