OK here's my dilemna. I can delete the row if my condition is met (Columns C = "Gone"), but I need to instead make a selection and delete just those cells and shift up.
Basically if cell C in a row = Gone, then offset (-2, 12) as selected cells,
then delete shiftup.
I've gotten close to making this work if I start with a range and name the range of cells in the sheet, but they insert rows throughout the day, so the range is dynamic.
Code is shown below with deleting the row instead of selecting cells and deleting those specific ones and shifting up.
Thanks in advance!!!!
Basically if cell C in a row = Gone, then offset (-2, 12) as selected cells,
then delete shiftup.
I've gotten close to making this work if I start with a range and name the range of cells in the sheet, but they insert rows throughout the day, so the range is dynamic.
Code is shown below with deleting the row instead of selecting cells and deleting those specific ones and shifting up.
Thanks in advance!!!!
Code:
Sub DeleteRowsC()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'Selects sheet to use
With Sheets("Today Sched")
'select the sheet so can change the window view
.Select
'If you are in Page Break Preview Or Page Layout view go
'back to normal view
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
'Turn off Page Breaks
.DisplayPageBreaks = False
'Set the second and last row to loop through
Firstrow = 2
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'Check the values in the C column
With .Cells(Lrow, "C")
If Not IsError(.Value) Then
If .Value = "Gone" Then .EntireRow.delete
'This will delete each row with the Value "Gone"
'in Column C, case sensitive.
End If
End With
Next Lrow
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub