oiya baru ingat kalau bisa difilter dari inputboxnya, berikut updatenya
* Kolom = Abs(Int(Application.InputBox("Mau Sampai Berapa Kolom ?",
"Nulis", Type:=1)))**
** Baris = Abs(Int(Application.InputBox("Mau Sampai Berapa Baris ?",
"Nulis", Type:=1)))**
****
** If Kolom < 1 Or Baris < 1 Then Exit Sub**
*
Pada 28/08/2013 18:16, Mr. Kid menulis:
Ok,
bagian yang di-biru oleh Pak Anton, bisa diganti dengan : (sambil
nunggu yang mau pake application.inputbox type=1)
Err.Clear
On Error Resume Next
Kolom = InputBox("Mau Sampai Berapa Kolom ?", "Nulis")
Baris = InputBox("Mau Sampai Berapa Baris ?", "Nulis")
If Err.Number <> 0 Then
Exit Sub
ElseIf Kolom < 1 Then
Exit Sub
ElseIf Baris < 1 Then
Exit Sub
End If
'If Not WorksheetFunction.IsNumber(Kolom) Or Not
WorksheetFunction.IsNumber(Baris) Then Exit Sub
Wassalam,
Kid.
On Wed, Aug 28, 2013 at 3:24 PM, summonery <[email protected]
<mailto:[email protected]>> wrote:
Mr Kid, boleh dicek kembali,
sepertinya ada yang kurang pas dibagian ini untuk error handlingnya:
(Uji coba dilakukan dengan Excel 2010)
Kolom = InputBox("Mau Sampai Berapa Kolom ?", "Nulis")
Baris = InputBox("Mau Sampai Berapa Baris ?", "Nulis")
If Not WorksheetFunction.IsNumber(Kolom) Or Not
WorksheetFunction.IsNumber(Baris) Then Exit Sub
Penggunaan *Application.*Inputbox dengan return data type 1
(number) dapat sebagai pertimbangan.
>semoga bermanfaat
--- In [email protected]
<mailto:[email protected]>, "Mr. Kid" wrote:
>
> eh lupa,
> baris :
> ReDim Data(1 To Baris, 1 To Kolom)
>
> jadi :
> ReDim Data(1 To Baris, 1 To Kolom) as long
>
>
>
> 2013/8/28 Mr. Kid mr.nmkid@...
>
> > 3D maksudnya dengan sheet ?
> >
> > misal ada 3 sheet
> >
> > Sub tes3d()
> > Dim Data() as long, Kolom As Long, Baris As Long, tStart As Double
> > Dim i As Long, j As Long, Counter As Variant, lSht as long
> >
> >
> > Kolom = InputBox("Mau Sampai Berapa Kolom ?", "Nulis")
> > Baris = InputBox("Mau Sampai Berapa Baris ?", "Nulis")
> >
> > If Not WorksheetFunction.IsNumber(Kolom) Or Not
> > WorksheetFunction.IsNumber(Baris) Then Exit Sub
> > ReDim Data(1 To Baris, 1 To Kolom)
> >
> > tStart = Timer
> > for lsht=1 to 3
> > For i = 1 To Baris
> > For j = 1 To Kolom
> > Counter = Counter + 1
> > Data(i, j) = Counter
> > Next j
> > Next i
> > sheets(lsht).Range("A1").CurrentRegion.ClearContents
> > sheets(lsht).Range("A1").resize(Baris, Kolom).value = Data
> > next lsht
> > MsgBox Timer - tStart & " detik"
> > End Sub
> >
> >
> > misal ada 3 sheet dan ndak urut, tapi nama-namanya sudah
diketahui :
> > Sub tes3d()
> > Dim Data() as long, Kolom As Long, Baris As Long, tStart As Double
> > Dim i As Long, j As Long, Counter As Variant, vSht as variant
> >
> >
> > Kolom = InputBox("Mau Sampai Berapa Kolom ?", "Nulis")
> > Baris = InputBox("Mau Sampai Berapa Baris ?", "Nulis")
> >
> > If Not WorksheetFunction.IsNumber(Kolom) Or Not
> > WorksheetFunction.IsNumber(Baris) Then Exit Sub
> > ReDim Data(1 To Baris, 1 To Kolom)
> >
> > tStart = Timer
> > for each vsht in
array("sheet1","sheet5","sheetEmbuh","satsitsatsit")
> > For i = 1 To Baris
> > For j = 1 To Kolom
> > Counter = Counter + 1
> > Data(i, j) = Counter
> > Next j
> > Next i
> > sheets(vsht).Range("A1").CurrentRegion.ClearContents
> > sheets(vsht).Range("A1").resize(Baris, Kolom).value = Data
> > next vsht
> > MsgBox Timer - tStart & " detik"
> > End Sub
> >
> > ;)
> >
> > Wassalam,
> > Kid.
> >
> >
> >
> >
> > 2013/8/27 De Premor de@...
> >
> >> **
> >>
> >>
> >> iya nih, keren :D
> >>
> >> Kalau untuk yang 3D kira2 gimana ya Mr. Kid ?
> >>
> >>
> >> On 27-08-2013 22:59, Mr. Kid wrote:
> >>
> >>
> >> baris :
> >> Range("A1", Range("A1").Offset(Baris - 1, Kolom - 1).Address)
= Data
> >>
> >> sepertinya bisa :
> >> Range("a1").resize(baris,kolom).value=data
> >>
> >> Wassalam,
> >> Kid.
> >>
> >>
> >>
> >> 2013/8/27 De Premor de@...
> >>
> >>> Range("A1", Range("A1").Offset(Baris - 1, Kolom -
1).Address) = Data
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
>