Solved

Conditional formatting for duplicates and all numbers in a table

Posted on 2011-02-15
7
345 Views
Last Modified: 2012-05-11
I have a very simple, but important task. I have attached a sheet and in that sheet I have a list of numbers in order. These numbers are station numbers that are used in a sequence to determine which station are dispatched to runs. I have about 200 sheets that I have to enter these station run numbers in various sequences.

It is very very important that each of the numbers shows up in each sheet. It is equal as important that I do no duplicate any numbers while enter them. I will make a validation list, so only these numbers will be accepted.

My questions is can I do some type of conditional formatting or validation so I don't repeat any numbers or I don't forget any numbers in each sheet?

Thanks for any help.

Brent RUN-ORDER.xls
0
Comment
Question by:bvanscoy678
  • 3
  • 3
7 Comments
 
LVL 24

Expert Comment

by:StephenJR
ID: 34897150
Do you enter the sequences manually?
0
 

Author Comment

by:bvanscoy678
ID: 34897258
Yes, I enter the sequence manually.
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34897288
Don't know if this is feasible for your actual file, but will produce a sheet at the end listing errors.
Sub x()

Dim ws As Worksheet, v, i As Long, vOut(), n As Long

v = Array(3, 31, 33, 1, 30, 34, 51, 5, 24, 61, 21, 22, 41, _
          53, 23, 52, 60, 42, 65, 43, 63, 56, 44, 77, 45, _
          "B1", "B3", "B2", "B5", "B6", "B4")
          
ReDim Preserve vOut(1 To Worksheets.Count * UBound(v), 1 To 3)

For Each ws In Worksheets
    For i = LBound(v) To UBound(v)
        If ws.UsedRange.Find(What:=v(i), Lookat:=xlWhole) Is Nothing Then
            n = n + 1
            vOut(n, 1) = ws.Name
            vOut(n, 2) = v(i)
        End If
        If WorksheetFunction.CountIf(ws.UsedRange, v(i)) > 1 Then
            n = n + 1
            vOut(n, 1) = ws.Name
            vOut(n, 3) = v(i)
        End If
    Next i
Next ws

Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Errors"
With Sheets("Errors")
    .Range("A1").Resize(, 3) = Array("Sheet", "Not found", "Duplicate")
    .Range("A2").Resize(n, 3) = vOut
End With

End Sub

Open in new window

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:bvanscoy678
ID: 34898197
I'll be honest, this solution is a little difficult for me to understand.
0
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 34898783
Use this tip to avoid entering duplicate values in a row with data validation:

http://www.contextures.com/xlDataVal07.html#Unique
It uses the approach to count the number of entries like the one you're entering in a range and if > 1 then doesn't let you enter the value.

Dave
0
 
LVL 24

Expert Comment

by:StephenJR
ID: 34898868
Happy to try to explain if you think it's an approach you want to pursue, there will be others.
0
 

Author Comment

by:bvanscoy678
ID: 34902025
Yes, that will work fine.

Thanks for the offer to explain, but seems it works just fine.

Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

MS Access 2003 or later To MySQL Migration Project Hello All, this is my second article in the category of MS-OFFICE Automation. In internet I am not able to find any comprehensive resource on the Migration of MS Access back-end to MySQL so I fin…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now