#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Column Code

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Column Code

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

On Thu, 23 Oct 2003 07:48:45 -0700, "DaveB"
wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Column Code

One way

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

"DaveB" wrote in message
...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Column Code

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

--
sb
"DaveB" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofill column from data (code) in column next to it Matt Excel Worksheet Functions 4 April 24th 09 06:17 PM
Code for dragging the last column Gaurav[_2_] Excel Worksheet Functions 5 November 10th 07 12:13 PM
Why the column code in my excel is 123... instead of ABC...? lberjy Excel Discussion (Misc queries) 1 October 24th 07 04:23 AM
Create Code Based on Column Brainfire Excel Discussion (Misc queries) 2 June 8th 07 01:04 PM
Code to save info to another column? evilsmiley Excel Discussion (Misc queries) 1 October 11th 05 10:47 PM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"