VBA Help
thank you... i was missing the space.
"Gord Dibben" wrote:
Just as it looks...........=60
Sub delete()
Sheets("Complete").Activate
n = Cells(Rows.Count, "I").End(xlUp).Row
k = 1
For i = n To 1 Step -1
If Cells(i, "I").Value = 60 Then
Cells(i, "I").EntireRow.delete
k = k + 1
End If
Next
End Sub
Gord Dibben MS Excel MVP
On Mon, 24 Nov 2008 11:39:01 -0800, Gila
wrote:
That is great!!!
Based off the code so far I modified it to look for anything with 60 in
column "I" and delete that row. Id like it to look for anything 60 or higher
(=60). I dont know how to do this expression in VBA though.
Sub delete()
n = Cells(Rows.Count, "I").End(xlUp).Row Sheets("Complete").Activate
k = 1
For i = n To 1 Step -1
If Cells(i, "I").Value = 60 Then
Cells(i, "I").EntireRow.delete
k = k + 1
End If
Next
End Sub
"Gary''s Student" wrote:
Sub lastr()
n = Cells(Rows.Count, "H").End(xlUp).Row
Sheets("Sheet2").Activate
k = Application.WorksheetFunction.Max(1, Cells(Rows.Count,
"H").End(xlUp).Row + 1)
Sheets("Sheet1").Activate
For i = n To 1 Step -1
If Cells(i, "H").Value = 1 Then
Cells(i, "H").EntireRow.Copy Sheets("Sheet2").Cells(k, 1)
Cells(i, "H").EntireRow.Delete
k = k + 1
End If
Next
End Sub
will not over-write any existing material on the second sheet.
--
Gary''s Student - gsnu200815
"Gila" wrote:
Thank you Gary''s Student,
This worked great, one thing though.
After the code transferred the row from sheet1 to "sheet2" it placed it into
row one. After testing it a second time I found it to over write the first
transfer in sheet2. Can it be written to transfer the identified row(s)
without overwriting rows with data in sheet2?
"Gary''s Student" wrote:
Perhaps:
Sub lastr()
n = Cells(Rows.Count, "H").End(xlUp).Row
k = 1
For i = n To 1 Step -1
If Cells(i, "H").Value = 1 Then
Cells(i, "H").EntireRow.Copy Sheets("Sheet2").Cells(k, 1)
Cells(i, "H").EntireRow.Delete
k = k + 1
End If
Next
End Sub
--
Gary''s Student - gsnu200815
|