G
gemiho
Hello everyone,
I wonder if you please could help me with a macro; I just started to us
VBA, so my knowledge is equal zero.
I have a workbook with a few sheets. I am trying to write a macro tha
after clicking on a cell it deletes the entire row if the cell in colum
A does not contain any text; actually I wanted it to do not delete th
row if the cell in column A contains the text “keepThisRow”, but I d
not know how to do it. I was thinking to use a Form button.
BellowI the code I have, but it does not work at all. thank you i
advance for all help
Sub deleteRow_Click()
Dim rng As Range
ActiveSheet.Unprotect Password:="123"
On Error GoTo ErrHandler
Set rng
Worksheets(ActiveSheet).Range("A2:A500").ActiveCell.Row.Select 'I wan
to select a cell in row I want to delete
If Not rng Is Nothing Then
rng.EntireRow.Delete xlUp
End If
Exit Sub
ErrHandler:
ActiveSheet.Protect Password:="123", DrawingObjects:=True
Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
AllowSorting:=True
End Su
I wonder if you please could help me with a macro; I just started to us
VBA, so my knowledge is equal zero.
I have a workbook with a few sheets. I am trying to write a macro tha
after clicking on a cell it deletes the entire row if the cell in colum
A does not contain any text; actually I wanted it to do not delete th
row if the cell in column A contains the text “keepThisRow”, but I d
not know how to do it. I was thinking to use a Form button.
BellowI the code I have, but it does not work at all. thank you i
advance for all help
Sub deleteRow_Click()
Dim rng As Range
ActiveSheet.Unprotect Password:="123"
On Error GoTo ErrHandler
Set rng
Worksheets(ActiveSheet).Range("A2:A500").ActiveCell.Row.Select 'I wan
to select a cell in row I want to delete
If Not rng Is Nothing Then
rng.EntireRow.Delete xlUp
End If
Exit Sub
ErrHandler:
ActiveSheet.Protect Password:="123", DrawingObjects:=True
Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
AllowSorting:=True
End Su