Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macros

Status
Not open for further replies.

HeathHol

Programmer
Jun 3, 2004
14
0
0
GB
Hi There....

I have two columns in excel -
In column A from Cell A1 - A8 I have the following values

0
96
100
0
0
56
78
0

I need a macro to evaluate whether this column is 0. If it is I want to write something like "Bad" next to this value in column B if it is not 0 then its corresponding value in column B will be "Good".

Anyone with any ideas??
Thanks for you help...
HH
 
A formula in column B could accomplish this.

Does it need to be scalable? Will it always be A1-A8?
Code:
sub somename()
    If ActiveCell.Offset(0, -1).Value = 0 Then
        ActiveCell.Value = "Bad"
    Else
        ActiveCell.Value = "Good"
    End If
    ActiveCell.Offset(1, 0).Select
end sub
start with this. Highlight B1 and run the code.

Kevin Petursson
--
"Everyone says quotable things everyday, but their not famous... so nobody cares."... Some Person
 
You could not only have formulae in column B to do this, but also use Conditional Formatting to highlight the bad entries.

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top