added functionality

  • Thread starter Thread starter ksnapp
  • Start date Start date
K

ksnapp

I need to modify this code a little bit

Sub DeleteRESERVE() ' deltes rows with reserve in column 3
Const cColumn = 3, cSearch = "RESERVE"
Dim i As Long, lngLastRow As Long
With ActiveSheet
lngLastRow = .Cells(Rows.Count, cColumn).End(xlUp).Row
For i = lngLastRow To 1 Step -1
If InStr(1, .Cells(i, cColumn).Value, cSearch) > 0 Then
.Rows(i).Delete xlShiftUp
End If
Next
End With
End Sub

If there is anything in column a of the same row, i need those content
copy pasted down one row. If the cell in column A is blank I i
doesn't need to do anything
 
If Cells(i, 1).Value <> "" Then
Cells(i + 1, 1).Value = Cells(i, 1).Value
End If

- Piku
 
Sub DeleteRESERVE() ' deltes rows with reserve in column 3
Const cColumn = 3, cSearch = "RESERVE"
Dim i As Long, lngLastRow As Long
With ActiveSheet
lngLastRow = .Cells(Rows.Count, cColumn).End(xlUp).Row
For i = lngLastRow To 1 Step -1
If InStr(1, .Cells(i, cColumn).Value, cSearch) > 0 Then
if not isempty(cells(i,"A")) then
cells(i+1,"A").Value = cells(i,"A").Value
End if
Rows(i).Delete xlShiftUp
End If
Next
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top