# setting

# ์—ด์ˆจ๊ธฐ๊ธฐ ๋ฐ ์‚ฌ์ด์ฆˆ ๋ณ€๊ฒฝ

Sub HideAndShowFunction()
    Dim resultMsgBox As VbMsgBoxResult
    resultMsgBox = MsgBox("์—ด์„ ์ˆจ๊ธธ์ง€ ์—ฌ๋ถ€ ์„ ํƒ", vbOKCancel)

    If resultMsgBox = vbOK Then
        Columns("A:KS").Hidden = True

        arrx = Array("C", "F", "K", "Q", "R", "Y", "Z", "AA", "AZ", "AK", "CG", "CH", "CI", "CO", "CS", "KR", "KS")
        arry = Array("50", "50", "40", "70", "80", "80", "80", "70", "50", "50", "50", "70", "90", "90", "100", "50", "50")
        Dim index As Long

        For index = LBound(arrx) To UBound(arrx)
            Columns(arrx(index)).Hidden = False
            Columns(arrx(index)).ColumnWidth = arry(index) / 5
        Next index

    Else
        Columns("A:KS").Hidden = False
    End If

    ActiveSheet.Cells(1, 1).Select
End Sub

# ์—ด์ˆจ๊ธฐ๊ธฐ 2

Sub HideAndShowFunction()
    Dim resultMsgBox As VbMsgBoxResult
    resultMsgBox = MsgBox("์—ด์„ ์ˆจ๊ธธ์ง€ ์—ฌ๋ถ€ ์„ ํƒ", vbOKCancel)

    If resultMsgBox = vbOK Then

        arrx = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X")
        arry = Array("20", "40", "40", "45", "40", "40", "80", "20", "20", "20", "80", "100", "250", "30", "100", "20", "20", "20", "40", "50", "40", "50", "50", "150")
        Dim index As Long

        For index = LBound(arrx) To UBound(arrx)
            Columns(arrx(index)).Hidden = False
            Columns(arrx(index)).ColumnWidth = arry(index) / 5
        Next index

        arrhide = Array("D", "E", "F", "H", "I", "J", "P", "Q", "R", "S", "V", "W")
        Dim indexHide As Long

        For indexHide = LBound(arrhide) To UBound(arrhide)
            Columns(arrhide(indexHide)).Hidden = True

        Next indexHide
    Else
        Columns("A:KS").Hidden = False
    End If

    ActiveSheet.Cells(1, 1).Select
End Sub

# pptx add slides, input title and content

Sub AddSlides()

Dim oPres As Presentation
Dim oSlide As Slide
Dim sTitle As String
Dim sContent As String

Set oPres = ActivePresentation

' 3. ์ฃผ์š” ๊ธฐ๋Šฅ ๋ฐ ํ™”๋ฉด ๊ตฌ์„ฑ

' ์Šฌ๋ผ์ด๋“œ ์ถ”๊ฐ€
Set oSlide = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutCustom)

' ์ œ๋ชฉ ์„ค์ •
sTitle = "3. ์ฃผ์š” ๊ธฐ๋Šฅ ๋ฐ ํ™”๋ฉด ๊ตฌ์„ฑ"
oSlide.Shapes.Title.TextFrame.TextRange.Text = sTitle

' ๋‚ด์šฉ ์ถ”๊ฐ€
sContent = "- ํ™ˆ ํ™”๋ฉด" & vbCrLf & _
"- ๊ฒ€์ƒ‰ ๋ฐ ํ•„ํ„ฐ๋ง ๊ธฐ๋Šฅ" & vbCrLf & _
"- ์‹๋‹น ์ƒ์„ธ ์ •๋ณด ๋ฐ ๋ฉ”๋‰ด ์„ ํƒ" & vbCrLf & _
"- ์ฃผ๋ฌธ ๋ฐ ๊ฒฐ์ œ" & vbCrLf & _
"- ์ฃผ๋ฌธ ํ˜„ํ™ฉ ๋ฐ ๋ฐฐ๋‹ฌ ์ถ”์ " & vbCrLf & _
"- ์‚ฌ์šฉ์ž ํ”„๋กœํ•„ ๋ฐ ์„ค์ •"
oSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 500, 300).TextFrame.TextRange.Text = sContent

' 4. ์ƒ์„ธ ํ™”๋ฉด ์„ค๊ณ„

' ์Šฌ๋ผ์ด๋“œ ์ถ”๊ฐ€
Set oSlide = oPres.Slides.Add(oPres.Slides.Count + 1, ppLayoutCustom)

' ์ œ๋ชฉ ์„ค์ •
sTitle = "4. ์ƒ์„ธ ํ™”๋ฉด ์„ค๊ณ„"
oSlide.Shapes.Title.TextFrame.TextRange.Text = sTitle

' ๋‚ด์šฉ ์ถ”๊ฐ€
sContent = "- ๊ฐ ํ™”๋ฉด์˜ ์š”์†Œ ๋ฐ ๊ธฐ๋Šฅ ์ •์˜" & vbCrLf & _
"- ์‚ฌ์šฉ์ž ์ธํ„ฐ๋ž™์…˜ ๋””์ž์ธ" & vbCrLf & _
"- UI ๋””์ž์ธ ๋ฐ ์‹œ๊ฐ์  ์š”์†Œ ์ •์˜"
oSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 500, 300).TextFrame.TextRange.Text = sContent

End Sub

# excel ๋ฐ์ดํ„ฐ๋ณ€๊ฒฝ

Sub Main()

Debug.Print "์‹œ์ž‘"

' ์‹œ์ž‘,์ข…๋ฃŒ ํ–‰
Dim startRow As Long
Dim lastRow As Long
startRow = 3
lastRow = Cells(Rows.Count, 1).End(xlUp).Row

' ์ฃผ๋ฌธ์ผ์ž
ChangeDate startRow, lastRow, "B", -1
' ๋ฐฐ์†ก์˜ˆ์ •์ผ
ChangeDate startRow, lastRow, "K", 7
' ์ œํœด์‚ฌ์ฃผ๋ฌธ๋ฒˆํ˜ธ
GenAllnOrdId startRow, lastRow, "F", -1
' ์‡ผํ•‘๋ชฐ๋ช…
GenSNSShop startRow, lastRow, "C", "ํ…Œ์ŠคํŠธ"

Debug.Print "์ข…๋ฃŒ"

End Sub

Sub ChangeDate(startRow As Long, lastRow As Long, inputCell As String, dayVal As Long)

' colNum
Dim colNum As Long
colNum = Evaluate(inputCell & "1").Column

' reqDate
Dim reqDate As Date
reqDate = DateAdd("d", dayVal, Date)

' x์—ด startRow๋ถ€ํ„ฐ lastRow๊นŒ์ง€ ๋ฐ˜๋ณต
Dim index As Integer
For index = startRow To lastRow
    Cells(index, colNum).Value = CStr(Format(reqDate, "yyyymmdd"))
    Range(inputCell & CStr(index)).NumberFormat = "@"
Next index

End Sub

Sub GenAllnOrdId(startRow As Long, lastRow As Long, inputCell As String, dayVal As Long)

' colNum
Dim colNum As Long
colNum = Evaluate(inputCell & "1").Column
' reqDate
Dim reqDate As Date
reqDate = DateAdd("d", dayVal, Date)

' x์—ด startRow๋ถ€ํ„ฐ lastRow๊นŒ์ง€ ๋ฐ˜๋ณต
Dim index As Integer
For index = startRow To lastRow
    ' "TEST202402150001" ํ˜•ํƒœ์˜ ๊ฐ’ ์ƒ์„ฑ
    Cells(index, colNum).Value = "TEST" & Format(reqDate, "yyyyMMdd") & Right("0000" & CStr(index - 2), 4)
Next index

End Sub

Sub GenSNSShop(startRow As Long, lastRow As Long, inputCell As String, val As String)

' colNum
Dim colNum As Long
colNum = Evaluate(inputCell & "1").Column

' x์—ด startRow๋ถ€ํ„ฐ lastRow๊นŒ์ง€ ๋ฐ˜๋ณต
Dim index As Integer
For index = startRow To lastRow
    Cells(index, colNum).Value = val
Next index

End Sub

Last Updated: 4/13/2025, 11:14:44 PM