ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF cell=TRUE how can I delete that row in formula (https://www.excelbanter.com/excel-programming/382582-if-cell%3Dtrue-how-can-i-delete-row-formula.html)

Stanley Braverman

IF cell=TRUE how can I delete that row in formula
 
I am using this code to test for near duplicate entries but can not auto
delete row that tests OK or TRUE

=IF(MID(A2,1,5)=MID(A3,1,5),IF(MID(B2,1,8)=MID(B3, 1,8),"OK","NOT OK"))



Bob Phillips

IF cell=TRUE how can I delete that row in formula
 
If you want to delete a row based upon a condition, that would need VBA. Is
that acceptable?

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Stanley Braverman" wrote in message
...
I am using this code to test for near duplicate entries but can not auto
delete row that tests OK or TRUE

=IF(MID(A2,1,5)=MID(A3,1,5),IF(MID(B2,1,8)=MID(B3, 1,8),"OK","NOT OK"))





macropod

IF cell=TRUE how can I delete that row in formula
 
Hi Stanley,

Formulae can't delete rows - you'd need a macro to automate that. For example, if you put the following code into the relevant
'Worksheet' module:
Private Sub Worksheet_Calculate()
Update
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells(1, 1) = Range("A1") Then
Update
End If
End Sub

and the following code into a standard module:

Sub Update()
If Range("A1").Value = "OK" Then
Range("A10").EntireRow.Hidden = True
Else
Range("A10").EntireRow.Hidden = False
End If
End Sub

Then, anytime you type 'OK' (case sensitive) into Cell A1, or its value is changed to 'OK' by a formula, Row 10 will be hidden.
Change the value in A1 to something else and Row 10 will be unhidden.

Modify the cell addresses/ranges to suit your needs.

Cheers

--
macropod
[MVP - Microsoft Word]


"Stanley Braverman" wrote in message ...
| I am using this code to test for near duplicate entries but can not auto
| delete row that tests OK or TRUE
|
| =IF(MID(A2,1,5)=MID(A3,1,5),IF(MID(B2,1,8)=MID(B3, 1,8),"OK","NOT OK"))
|
|



Dave Peterson

IF cell=TRUE how can I delete that row in formula
 
Maybe you can apply data|Filter|autofilter to show only the rows you want to
delete.

Then you can delete those visible rows.



Stanley Braverman wrote:

I am using this code to test for near duplicate entries but can not auto
delete row that tests OK or TRUE

=IF(MID(A2,1,5)=MID(A3,1,5),IF(MID(B2,1,8)=MID(B3, 1,8),"OK","NOT OK"))


--

Dave Peterson

Stanley Braverman

IF cell=TRUE how can I delete that row in formula
 
data|Filter|autofilter works perfectly. Thanks for that easy
solution!!!!!!

"Dave Peterson" wrote in message
...
Maybe you can apply data|Filter|autofilter to show only the rows you want
to
delete.

Then you can delete those visible rows.



Stanley Braverman wrote:

I am using this code to test for near duplicate entries but can not auto
delete row that tests OK or TRUE

=IF(MID(A2,1,5)=MID(A3,1,5),IF(MID(B2,1,8)=MID(B3, 1,8),"OK","NOT OK"))


--

Dave Peterson





All times are GMT +1. The time now is 08:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com