0% found this document useful (0 votes)
10 views

Coding Form Stok

This tutorial demonstrates how to filter data from one range and copy it to another range in Excel using VBA. It shows filtering data on a sheet using criteria, then copying the filtered data to another range if rows are found, or displaying a message if no rows are found.

Uploaded by

raihanbahansubu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Coding Form Stok

This tutorial demonstrates how to filter data from one range and copy it to another range in Excel using VBA. It shows filtering data on a sheet using criteria, then copying the filtered data to another range if rows are found, or displaying a message if no rows are found.

Uploaded by

raihanbahansubu
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

--------------------------------------------

COSING FORM STOK - EXCEL & VBA TUTORIAL


--------------------------------------------
Option Explicit

Private Sub UserForm_Initialize()


Me.BackColor = RGB(38, 41, 47)
On Error GoTo Salah
Dim iRow As Long
Dim DCARIDATA As Object
Set DCARIDATA = Sheet3
DCARIDATA.Range("A5").CurrentRegion.AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:= _
Sheet3.Range("J5:J6"), CopyToRange:=Sheet3.Range("L5:S5"), Unique:=False
iRow = Sheet3.Range("L" & Rows.Count).End(xlUp).Row
If Application.WorksheetFunction.CountA(Sheet3.Range("L6:L999999")) = 0 Then
Me.TABELDATA.RowSource = ""
Call MsgBox("Data tidak ditemukan", vbInformation, "Cari Data")
Else
Me.TABELDATA.RowSource = "PRODUK!L6:S" & iRow
End If
Exit Sub
Salah:
Call MsgBox("Maaf Data tidak ditemukan", vbInformation, "Cari Data")

End Sub

You might also like