Desu Nota from Columbus
Well-known Member
- Joined
- Mar 17, 2011
- Messages
- 556
I am in the process of creating a macro that will eventually have many steps.
I currently have two steps:
1) Delete a bunch of columns and then shift everything left (works)
2) Delete all rows if they don't have "shift" in Column U (does not do anything) Why?
I currently have two steps:
1) Delete a bunch of columns and then shift everything left (works)
2) Delete all rows if they don't have "shift" in Column U (does not do anything) Why?
Code:
Sub StepwiseMacro()
Range("A:A,C:C,E:E,F:F,H:H,I:I,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,W:W,AF:AF,AG:AG,AJ:AJ,AK:AK,AL:AL,AM:AM,AN:AN,AO:AO,AP:AP,AQ:AQ,AT:AT,AV:AV,AU:AU,AW:AW,AX:AX,AY:AY").Select
Selection.Delete Shift:=xlToLeft
Dim LR As Long
Dim r As Long
With Sheet1
LR = .Range("U" & .Rows.Count).End(xlUp).Row
For r = 1 To LR
Select Case .Range("U" & r).Value
Case Is = "Stub_Shift"
EntireRow.Delete Shift:=xlUp
Case Is = "Job"
EntireRow.Delete Shift:=xlUp
Case Is = "Stub_Job"
EntireRow.Delete Shift:=xlUp
End Select
Next r
End With
End Sub