Removing a duplicate entry & preventing data entry in the cell that had the duplicate.

FrancisM

Board Regular
Joined
Apr 12, 2016
Messages
139
I have a worksheet that is used to make reservations for appointments in 1/5-hour increments. Occasionally a 1-hour slot is required, So, if a hour appointment is made, there is a second entry in these cell ranges B4:C10, B13:C17, E4:E10, E13:E17. I am trying to remove the second entry, & prevent any other entry in these ranges, where the previous entry was located. These are the sheet numbers that don’t need the code to run. "Sheet1", "Sheet11", "Sheet21", "Sheet31", "Sheet41", "Sheet42", "Sheet43", "Sheet44", "Sheet 45", "Sheet46", "Sheet47", "Sheet48", "Sheet49", "Sheet50", "Sheet51", "Sheet52", "Sheet53", "Sheet54", "Sheet55", "Sheet56", "Sheet57", "Sheet82". I have another Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) code located in Thisworkbook, so I would just add this to that code.
Is what I am asking even possible? I have googled, & have duplicate removal, highlight, & other possibilities, but not what I am asking.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I have found this code form an earlier post (remove data but keep the Conditional Formatting - 12 April, 2004 - DRJ -Answer).

Code:
[COLOR=#333333]Sub Test()[/COLOR]
Dim Cell As Object

    Sheets("Sheet1").Range("A2:T49").FormatConditions.Delete
    For Each Cell In Sheets("Sheet1").Range("A2:T49")
        Select Case Cell.Value
            Case 1 'Color Green
                Cell.Interior.ColorIndex = 10
            Case 2 'Color Red
                Cell.Interior.ColorIndex = 3
            Case Else
        End Select
    Next
     [COLOR=#333333]End Sub
[/COLOR]
I am wondering if it would be possible to use a variation of this code along with the standard conditional formatting of duplicates. The duplicates will be dynamic, & not static.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top