# Help with macro about deleting cells according to other cell

#### r_ivica

##### Board Regular
not sure how to do this macro, hopefully not very complicated but don't know how to do it - so i would like to have this:

- if in Q5 is word LAY to delete cell T5
- if in Q6 is word LAY to delete cell T6
- if in Q7 is word LAY to delete cell T7
- if in Q8 is word LAY to delete cell T8
- if in Q9 is word LAY to delete cell T9
- if in Q10 is word LAY to delete cell T10
- if in Q11 is word LAY to delete cell T11
- if in Q12 is word LAY to delete cell T12
- if in Q13 is word LAY to delete cell T13
- if in Q14 is word LAY to delete cell T14
- if in Q15 is word LAY to delete cell T15
- if in Q16 is word LAY to delete cell T16
- if in Q17 is word LAY to delete cell T17
- if in Q18 is word LAY to delete cell T18
- if in Q19 is word LAY to delete cell T19
- if in Q20 is word LAY to delete cell T20

tnx for helping!

### Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

#### r_ivica

##### Board Regular
i made this with recording macro and inserting IF formulas..

but now i have only one more little different problem which i don't know to solve.

I am using conditional formatting - if cell value is more than A1 (some number) to have cell in yellow color which works fine, but a lot of time this cell have 0,00 but if there is 0,00 i would like that conditional formatting would be ignored! (not to have in this case cell yellow)

How can i achieve this?

#### Dylan

##### Board Regular
Code:
``````Sub DeleteCell()
Dim MyWord As String
Dim r, I As Integer

r = Range("Q65536").End(xlUp).Row

For I = 5 To r
MyWord = Range("Q" & I).Value
If MyWord = "Lay" Then
Range("T" & I).ClearContents
End If
Next I

End Sub``````

#### Dylan

##### Board Regular
I am using conditional formatting - if cell value is more than A1 (some number) to have cell in yellow color which works fine, but a lot of time this cell have 0,00 but if there is 0,00 i would like that conditional formatting would be ignored! (not to have in this case cell yellow)

So, what is the value in A1 when your cell is 0,000?

#### r_ivica

##### Board Regular
I am using conditional formatting - if cell value is more than A1 (some number) to have cell in yellow color which works fine, but a lot of time this cell have 0,00 but if there is 0,00 i would like that conditional formatting would be ignored! (not to have in this case cell yellow)

So, what is the value in A1 when your cell is 0,000?

ok, let's say in A1 is 2,00 and if i input in B1 2,10 i want to have A1 cell yellow, so if B1 is higher than A1 want to have A1 yellow - which i have in excel worked out, but problem is when in A1 is 0,00 number and in B1 i have any number than A1 is yellow again which i don't want, i want that in this case, when there is 0,00 not to have it yellow!

This is formula which i have input in conditional formatting formula line and working, but also with zero which is not good:
=AND(\$B\$1>=\$A\$1)

#### Dylan

##### Board Regular
Try this
=AND(\$B\$1>=\$A\$1,\$A\$1>0)

Replies
1
Views
570
Replies
5
Views
284
Replies
37
Views
4K
Replies
13
Views
475
Replies
8
Views
677

1,190,561
Messages
5,981,695
Members
439,730
Latest member
gjvv

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back