# 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
โ - userland - visualstudio โ