Column Code

D

DaveB

I have 2 columns in my worksheet:
Column A Column B
10 TRUE
0 FALSE
4 TRUE
0 FALSE
2 TRUE

For every FALSE in column B, I would like column A to be
-997.

Thanks in advace for the code.
DaveB
 
D

DavidP

A number of ways to do this. How about filtering on False in column B
and then enter -997 in all the found rows
 
D

Don Guillett

One way

for each c in [b2:b200]
if ucase(c)="FALSE" then c.offset(,-1).value=-997
next
 
S

steve

Dave,

Sub Falser()
Dim lrow As Long, x As Long

' determine number of rows
lrow = Cells(Rows.Count, "A").End(xlUp).Row

' loop and replace
For x = 1 To lrow
If LCase(Cells(x, 2)) = "false" Then
Cells(x, 1) = -997
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top