UserForm ComboBox 조회기간 선택 처리 - Heeyoung-Ahn/Excel_VBA GitHub Wiki
Select Case cbo1
Case "전체"
txt1 = "2018-01-01"
txt2 = Date
Case "금월"
txt1 = DateSerial(Year(Date), Month(Date), 1)
txt2 = Date
Case "전월"
txt1 = DateSerial(Year(DateAdd("m", -1, Date)), Month(DateAdd("m", -1, Date)), 1)
txt2 = DateSerial(Year(Date), Month(Date), 1) - 1
Case "금년"
txt1 = DateSerial(Year(Date), 1, 1)
txt2 = Date
Case "최근3개월"
txt1 = DateAdd("m", -3, Date)
txt2 = Date
Case "최근6개월"
txt1 = DateAdd("m", -6, Date)
txt2 = Date
Case "최근1년"
txt1 = DateAdd("yyyy", -1, Date)
txt2 = Date
End Select