Closed Thread
Results 1 to 2 of 2

Set flag if column has dup

  1. #1
    Registered User
    Join Date
    01-26-2009
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    9

    Set flag if column has dup

    I have this macro:

    Private Sub Worksheet_Change(ByVal Target As Range)


    Dim MaxCount As Integer
    Dim StartCount As Integer
    Dim CountRange As String
    Dim LChangedValue As String
    On Error GoTo ErrorHandler
    Application.ScreenUpdating = False

    MaxCount = 20
    StartCount = 6

    'Clear all flags
    CountRange = "A6:A" & MaxCount
    Range(CountRange).Interior.ColorIndex = xlNone


    While StartCount < MaxCount
    LChangedValue = "A" & CStr(StartCount)
    test = Application.WorksheetFunction.CountIf(Range("A6:A999"), "A" & CStr(StartCount))
    If test > 1 Then
    Range(LChangedValue).Interior.ColorIndex = 3
    Worksheets("Room and Bed").Range("B" & CStr(StartCount)).Value = "This is text"
    End If
    StartCount = StartCount + 1
    Wend

    ErrorHandler:
    Application.EnableEvents = True
    Application.ScreenUpdating = True


    End Sub

    I think it should do what I need it to do but at present worksheet function is not assigning any value. Is there something I am missing or something I may have done which will make this not work.

    Thanks

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Set flag if column has dup

    Duplicate Thread

    http://www.excelforum.com/excel-work...-set-flag.html

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1