데이터 분석, 차트 작성, 전달을 위한 도구를 갖춘 Microsoft 스프레드시트 소프트웨어 제품군입니다.
이 응답은 자동 번역되었습니다. 따라서 문법 오류나 이상한 표현이 있을 수 있습니다.
안녕하세요. 진서 박고객님
Microsoft 커뮤니티에 게시해 주셔서 감사합니다.
설명에 따라 여러 셀에서 중복 날짜를 제거하고 하나의 셀로 결합하는 방법이 궁금할 수 있습니다. 이를 위해 VBA(Visual Basic for Applications)를 사용합니다. 새 매크로를 만들고 다음 코드를 모듈에 붙여넣을 수 있습니다.
Dim rng As Range
Dim cell As Range
Dim mergedText As String
Dim uniqueDates() As String
Dim i As Long, j As Long
Dim dict As Object
Dim outputRange As Range
If Selection.Cells.Count = 1 Then
MsgBox "Please select the cells before running the macro", vbInformation, "Warning"
Exit Sub
End If
Set dict = CreateObject("Scripting.Dictionary")
For Each cell In Selection
mergedText = mergedText & cell.Value & vbLf
Next cell
uniqueDates = Split(mergedText, vbLf)
For i = LBound(uniqueDates) To UBound(uniqueDates)
If Trim(uniqueDates(i)) <> "" Then
dict(uniqueDates(i)) = 1
End If
Next i
Set outputRange = Selection.Cells(1).Offset(Selection.Rows.Count, 0)
For Each Key In dict.Keys
outputRange.Value = outputRange.Value & vbLf & Key
Next Key
If Not IsEmpty(outputRange) Then
outputRange.Value = Mid(outputRange.Value, Len(vbLf) + 1)
outputRange.WrapText = True
End If
Set dict = Nothing
다음은 프로세스의 데모입니다.
더 궁금한 점이 있으시면 언제든지 저희에게 연락해 주십시오!
아무쪼록 이해와 협력을 부탁드립니다. 잘 지내시길 바랍니다!
감사합니다
토마스 C - MSFT | Microsoft 커뮤니티 지원 전문가