klik di sini
https://trumpexcel.com/vba-ucase/
Option Explicit Sub test() Dim fileku As String, lokasi As String lokasi = "D:\Raport Nafa\" fileku = Dir(lokasi & "*.xlsm") Do While fileku <> "" Workbooks.Open lokasi & fileku fileku = Dir() Loop End Sub
Option Explicit Sub test() Dim hitung As Integer hitung = 1 Do While hitung <= 5 MsgBox "Saya hitung ya " & hitung, vbOKOnly, "info" hitung = hitung + 1 Loop End Sub
Option Explicit Sub nutup() Dim wb As Workbook For Each wb In Workbooks If wb.Name <> ThisWorkbook.Name Then wb.Close End If Next wb End Sub =================================== Sub nutup() Dim ws As Worksheet For Each ws In Worksheets ws.Visible = xlSheetVisible Next ws End Sub
Sub test()
Dim i As Integer
For i = 1 To 5
Worksheets.Add
Next i
End Sub
---------------------------------
'kombinasi dengan inputbox
Sub test()
Dim i As Integer
Dim jumlah As Integer
jumlah = InputBox("Masukkan jumlah sheet yang mau ditambahkan?", "Tambah")
For i = 1 To jumlah
Worksheets.Add
Next i
End Sub
----------------------------------
Sub test()
Dim i As Integer
Dim jumlah As Variant
jumlah = InputBox("Masukkan jumlah baris yang akan disembunyikan?", "Jumlah Baris")
If jumlah = "" Then
Exit Sub
End If
For i = 4 To jumlah
Rows(i).Hidden = True
Next i
End Sub
------------------------
Public Sub ExampleDoWhileCalcLoop()
Dim i As Integer
i = 5
Do While Cells(i, 2) <> ""
Cells(i, 3).Value = Cells(i, 2).Value + 30
i = i + 1
Loop
============================
Public Sub DoUntilLoopEx()
Dim i As Integer
i = 1
Do Until IsEmpty(Cells(i, 1))
Cells(i, 1).Value = "info"
i = i + 1
Loop
Public Sub ExitForExample()
Dim x As Byte
For x = 1 To 50
Range("B" & x).Select
If Range("B" & x).Value = "Stop" Then
Exit For
ElseIf Range("B" & x).Value = "" Then
Range("B" & x).Value = "info"
End If
Next x
=BYROW(D2:D100; LAMBDA(tanggal_lahir; IF(tanggal_lahir=""; ""; DATEDIF(tanggal_lahir; TODAY(); "y"...