ahmed sousi
New Member
- Joined
- Sep 25, 2015
- Messages
- 3
in below vba code , i would like to replace all "B" in this code by range selecting or entering from application input box , kindly advise ,
Sub ahmed_code()
Dim lr As Long, r As Long, x As Long
Application.ScreenUpdating = False
lr = Range("B" & Rows.Count).End(xlUp).Row
For r = lr To 2 Step -1
x = WorksheetFunction.CountIf(Range("Sheet2!$A:$A"), Cells(r, "B"))
If x = 0 Then
Cells(r, "B").Resize(, 500).Delete Shift:=xlUp
End If
Next r
Application.ScreenUpdating = True
MsgBox "DONE YA M3alem ... Ahmed.Sousi ^_^ "
End Sub
Sub ahmed_code()
Dim lr As Long, r As Long, x As Long
Application.ScreenUpdating = False
lr = Range("B" & Rows.Count).End(xlUp).Row
For r = lr To 2 Step -1
x = WorksheetFunction.CountIf(Range("Sheet2!$A:$A"), Cells(r, "B"))
If x = 0 Then
Cells(r, "B").Resize(, 500).Delete Shift:=xlUp
End If
Next r
Application.ScreenUpdating = True
MsgBox "DONE YA M3alem ... Ahmed.Sousi ^_^ "
End Sub