I have a list of names down column D and corresponding vacation days across the row, F through Z. example below
D E F G H I
I get data from a report, i just copy it over into the last rows, then re-sort the dates in order. this places the dates in order across the row and sometimes it will have dates i already have on my workbook.
I am trying to run a macro across the row to remove duplicates days F through Z. just trying to remove one of the duplicate date across that row.
I found plenty of information on how to remove duplicates from a report but some of the dates maybe a duplicate as two people may have that same day off. i just want to remove duplicate from the row so the date does not show twice under the same person name.
any idea on how i can run this?
here is what i have for sorting the dates:
D E F G H I
Name | Next day off: | Scheduled Vacation Days: | |||
Jane Smith | 12/1/2020 | 12/1/2020 | 12/2/2020 | 12/4/2020 | 12/4/2020 |
William Jones | 12/8/2020 | 12/8/2020 | 12/10/2020 | 12/10/2020 | 12/23/2020 |
John Doe | 1/4/2021 | 12/23/2021 | 12/24/2021 | 1/6/2021 | 1/6/2021 |
I get data from a report, i just copy it over into the last rows, then re-sort the dates in order. this places the dates in order across the row and sometimes it will have dates i already have on my workbook.
I am trying to run a macro across the row to remove duplicates days F through Z. just trying to remove one of the duplicate date across that row.
I found plenty of information on how to remove duplicates from a report but some of the dates maybe a duplicate as two people may have that same day off. i just want to remove duplicate from the row so the date does not show twice under the same person name.
any idea on how i can run this?
here is what i have for sorting the dates:
VBA Code:
Sub SortVacationDays()
Call DeleteOldDates
Dim X, strRow As Integer
Application.ScreenUpdating = False
strRow = 3
'Sort Rows
For X = 1 To 151
strRow = strRow + 1
Sheets("Vacation Days").Select
range(CStr("F" & (strRow) & ":AG" & (strRow))).Select
ActiveWorkbook.Worksheets("Vacation Days").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Vacation Days").Sort.SortFields.Add Key:=range(CStr("F" & (strRow) & ":AZ" & (strRow))), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Vacation Days").Sort
.SetRange range(CStr("F" & (strRow) & ":AZ" & (strRow)))
.Header = xlGuess
.MatchCase = False
.Orientation = xlLeftToRight
.SortMethod = xlPinYin
.Apply
End With
range(CStr("F" & (strRow))).Select
Next X
Application.ScreenUpdating = True
range("A1").Select
End Sub
Last edited by a moderator: