Hello,
I need a code to copy an entire row to another worksheet if a specific cell has a certain value...
For example:
If cell B4 is equal to 200, copy entire row 4 to another worksheet...
Any help?
Thanks again,
Pat.
Hello,
I need a code to copy an entire row to another worksheet if a specific cell has a certain value...
For example:
If cell B4 is equal to 200, copy entire row 4 to another worksheet...
Any help?
Thanks again,
Pat.
With the supplied information, this might do it
Please Login or Register to view this content.
GenericPat,
Try this to see if it might get you headed in the right direction:
Please Login or Register to view this content.
The Worksheets("Sheet1") and ("Sheet2") you can substitute for the worksheets in your workbook.
hth,
Dennis
Doesn't seem to be working on my end
Any chance you can make a simplified version of Excel with the intergrated code and post it?
Thanks,
Pat.
Try This..
Sub Copy_Row()
Application.ScreenUpdating = False
Dim varSourceRow As Integer
Dim varTargetRow As Integer
'Determine the next available row on sheet2
Sheets("Sheet2").Select
varTargetRow = Cells(5000, 1).End(xlUp).Offset(1, 0).row
'Set top row for sheet1
varSourceRow = 2
Sheets("Sheet1").Select
Do 'Loop through all rows on Sheet1 and copy if cell value is 200
Cells(varSourceRow, 1).Select
If ActiveCell.Offset(0, 0).Value = "200" Then
Range(Cells(varSourceRow, 1), Cells(varSourceRow, 180)).Select
Selection.Copy
Sheets("Sheet2").Select
Range(Cells(varTargetRow, 1), Cells(varTargetRow, 180)).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
varSourceRow = varSourceRow + 1
varTargetRow = varTargetRow + 1
Else
varSourceRow = varSourceRow + 1
End If
Loop Until ActiveCell.Value = ""
End Sub
Ok it doesnt seem to work could you write something for my updated version...
I want all the rows in which the cells in Column H are greater then 4 999 999.99$ in sheet (Base de données) to be copied to sheet (Profil +5 Million $) starting on row 2!
Thanks
Pat.
Something like this possibly.
If you have columns past Column H, code needs to be adjusted for that.Please Login or Register to view this content.
Let us know.
Good Luck
John
Here is another approach. (See attached)
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks