View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default copy row from one sheet to another if certain condition is met

hi,

Sub test()
Dim sh1 As Sheets, sh2 As Sheets, n As Long, i As Long, rw As Long
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet6")

n = 20 '------------------------- may be adapt to Cells(sh1.Rows.Count,
1).End(xlUp).Row

For i = 1 To n
If sh1.Cells(i, 19) = "x" Then
rw = Cells(sh2.Rows.Count, 1).End(xlUp).Row + 1
sh1.Rows(i).Copy sh2.Cells(rw, 1)
End If
Next
End Sub

isabelle

Le 2015-04-10 23:13, a écrit :
If sheet1 has an x in column S

copy sheet1 entire row to next blank row in sheet 6