How to identify duplicate time frames in Excel office VBA?
Tags: toidentifyduplicatet, vbamacros
Published: 2021-09-17 03:36:44

---
title: How to identify duplicate time frames in Excel office VBA?
published: true
date: 2021-09-16 09:41:50 UTC
tags: ToIdentifyDuplicateT,VBAMacros
canonical_url: https://geekexcel.com/how-to-identify-duplicate-time-frames-in-excel-office-vba/
---

In this tutorial, we will guide you on how to  **Identify Duplicate Time Frames** in Excel Office VBA. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, you have to **create a spreadsheet** with **multiple time stamped entries for people**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Multiple-Time-Stamp-1024x209.png)<figcaption>Sample Time Stamp</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic option](https://geekexcel.com/wp-content/uploads/2020/09/1-106.png)<figcaption>Select the Visual Basic option</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```

Sub FindOverlapTime()
Dim rng As Range, cell As Range, trng As Range, tcell As Range
Dim lr As Long

lr = Cells(Rows.Count, "A").End(xlUp).Row
Range("A2:H" & lr).Interior.ColorIndex = xlNone
Set rng = Range("C2:C" & lr)
For Each cell In rng
    If Application.CountIf(Range("C2", cell), cell.Value) > 1 Then
        Set trng = Range("F2:F" & cell.Row - 1)
        For Each tcell In trng
            If tcell.Offset(0, -3) = cell Then
                If (cell.Offset(0, 3) >= tcell And cell.Offset(0, 3) <= tcell.Offset(0, 1)) _ Or (cell.Offset(0, 4) >= tcell And cell.Offset(0, 4) <= tcell.Offset(0, 1)) Then
                    Range("A" & cell.Row & ":H" & cell.Row).Interior.ColorIndex = 3
                End If
            End If
        Next tcell
    End If
Next cell
End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-43-1024x306.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Then, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-24.png)<figcaption>Run the Code</figcaption>

- Finally, you will get  **output ** as given below in the Excel.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-15-1024x204.png)<figcaption>Output</figcaption>

## A Brief Synopsis

Here, we have explained the step-by-step procedure ** ** on how to **Identify Duplicate Time Frames** in Excel Office VBA. Make use of this. Please share your worthwhile  **feedback**  in the below  **comment**  section. To learn more, check out our website **[Geek Excel](https://geekexcel.com/)!!**

**Keep Reading:**

- **[Excel Formulas to Check If Cell Value is Greater than Given Criteria!!](https://geekexcel.com/excel-formulas-if-cell-value-is-greater-than-given-criteria/)**
- **[Formulas for Counting the Cells Greater than a Given Values in Excel!!](https://geekexcel.com/formulas-for-counting-the-cells-greater-than-a-given-values-in-excel/)**
- **[Excel Formulas to Sum the Values Greater than a Certain Date!!](https://geekexcel.com/excel-formulas-to-sum-the-values-greater-than-a-certain-date/)**
- **[Excel Formulas to Sum the Values that are Greater than Certain Value!!](https://geekexcel.com/excel-formulas-to-sum-the-values-that-are-greater-than-certain-value/)**
- **[Excel Formulas to Highlight Values Greater than a Certain Value!!](https://geekexcel.com/excel-formulas-to-highlight-values-greater-than-a-certain-value/)**