Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Does value exist in column?

Posted on 2014-12-05
6
Medium Priority
?
106 Views
Last Modified: 2014-12-05
In VBA I need to set a True or False value based on values in column E.
Is there a way to tell Excel to set ColumnDoesNotHaveZero = True?  If there are no zeros in that column.
Column E can have any value in it, except a "0", if there is a zero? set ColumnDoesNotHaveZero = False
Please advise and thanks.
0
Comment
Question by:RWayneH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 36

Expert Comment

by:Kimputer
ID: 40483229
I'd say, set Worksheet_Change event, and inside, have it check only if column E was edited, enumerate every value of the column E, based on own limit, or UsedRange, and then set the ColumnDoesNotHaveZero value).
0
 

Author Comment

by:RWayneH
ID: 40483239
Worksheet is a static export from an extract.  Just need to check for it.
0
 
LVL 33

Assisted Solution

by:Rob Henson
Rob Henson earned 400 total points
ID: 40483247
Set Flag based on WorksheetFunction.COUNTIF($E:$E,0)

If Count is 0 - Flag = True; If Count >0 - Flag = False

Thanks
Rob H
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 36

Accepted Solution

by:
Kimputer earned 1600 total points
ID: 40483257
Then simple VBA code will do?

Sub test()

Dim ColumnDoesNotHaveZero As Boolean

ColumnDoesNotHaveZero = True

Count = ActiveSheet.UsedRange.Rows.Count

For i = 1 To Count Step 1
    If ActiveSheet.Cells(i, 5).Value = 0 Then
        ColumnDoesNotHaveZero = False
    End If
Next

MsgBox ColumnDoesNotHaveZero

End Sub

Open in new window

0
 

Author Comment

by:RWayneH
ID: 40483258
Rob
These lines show red in the editor.
0
 

Author Closing Comment

by:RWayneH
ID: 40483284
Thank for the help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question