Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Tungana,
Try: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim rng As Range Dim rcell As Range Dim delRng As Range Dim LRow As Long Dim CalcMode As Long Const sStr As String = "manager" '<<===== CHANGE Set WB = ActiveWorkbook '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE LRow = Cells(Rows.Count, "B").End(xlUp).Row Set rng = SH.Range("B1").Resize(LRow) With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With For Each rcell In rng.Cells If LCase(rcell.Value) = LCase(sStr) Then If delRng Is Nothing Then Set delRng = rcell Else Set delRng = Union(rcell, delRng) End If End If Next rcell If Not delRng Is Nothing Then delRng.EntireRow.Delete Else 'nothing found, do nothing End If With Application .Calculation = CalcMode .ScreenUpdating = True End With End Sub '<<============= --- Regards, Norman "TUNGANA KURMA RAJU" wrote in message ... I am looking for a macro,that checks a value in a w/sheet range B:B ,if found,delete the row. Example: col a-----------------------col b-----------------------colc john-----------------------manager------------------$500 lucy------------------------supervisor-----------------$250 cathy----------------------manager-------------------$650 Ibrahim-------------------supervisor------------------$325 david----------------------worker----------------------$200 macro should check,suppose a value in b:b 'manager' ,if I run macro,the list will be Col a----------------------col b-------------------------col c lucy------------------------supervisor-----------------$250 Ibrahim-------------------supervisor------------------$325 david----------------------worker----------------------$200 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Deleting rows in a macro in Excel | Excel Discussion (Misc queries) | |||
Macro Help In Excel | Excel Discussion (Misc queries) | |||
Macro to delete | New Users to Excel | |||
How can we delete rows permanently from excel sheet | Excel Discussion (Misc queries) | |||
In a protected worksheet allow users to delete rows | Excel Worksheet Functions |