Microsoft Office Excel ® Kod Kılavuzu

Microsoft Office Excel® Code Guide

20 Ağustos 2008 Çarşamba

Delete Rows




'Sheets("Sayfa1") Module

Option Explicit
Dim SonSatır As Variant
Dim r As Single

Private Sub CommandButton1_Click()
On Error Resume Next
Call BoşSatırlarıSil
End Sub
Sub BoşSatırlarıSil()
On Error GoTo Hata:
SonSatır = ActiveSheet.UsedRange.Row - 1 + ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For r = SonSatır To 1 Step -1
If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
Next r
Hata:
End Sub

10 Ağustos 2008 Pazar

UserForm QueryClose




'UserForm1

'Add Tools on UserForm1: Label1, label2, Label3, ComboBox1, ComboBox2, Label4
Option Explicit
Dim Vazgeçme As Boolean
Dim Yöntemi As Long

Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "[PBİD®] UserForm QueryClose..."
With ComboBox1
'Cancel

.AddItem "False"
.AddItem "True"
.ListIndex = 0
End With
With ComboBox2
'CloseMode

.AddItem "0"
.AddItem "1"
.ListIndex = 0
End With
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
UnLoad Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
On Error Resume Next
CloseMode = Yöntemi
If CloseMode = 0 Then
Cancel = Vazgeçme
Else
Cancel = True
End If
End Sub
Private Sub ComboBox1_Change() 'Cancel
On Error Resume Next
Vazgeçme = ComboBox1.Value
If Vazgeçme = False And Yöntemi = 0 Then
CommandButton1.Enabled = True
Else
CommandButton1.Enabled = False
End If
End Sub
Private Sub ComboBox2_Change() 'CloseMode
On Error Resume Next
Yöntemi = ComboBox2.Value
If Vazgeçme = False And Yöntemi = 0 Then
CommandButton1.Enabled = True
Else
CommandButton1.Enabled = False
End If
End Sub

1 Ağustos 2008 Cuma

Create New vbComponents (Sheet, Chart, DialogSheet)




'UserForm1

'Add Tools on UserForm1: ComboBox1, Label1, TextBox1, ListBox1, CommandButton1, Label2, Label3
Option Explicit
Dim i As Integer
Dim Tip, Eleman, YeniEleman

Private Sub UserForm_Initialize()
On Error Resume Next
Me.Caption = "[PBİD®] CREATE New vbComponents on UserForm..."
With ComboBox1
.AddItem 1: .List(0, 1) = "xlWorksheet"
.AddItem 2: .List(1, 1) = "xlChart"
.AddItem 3: .List(2, 1) = "xlExcel4MacroSheet"
.AddItem 4: .List(3, 1) = "xlExcel4IntlMacroSheet"
.AddItem 5: .List(4, 1) = "xlDialogSheet"
.ColumnCount = 2
.ColumnWidths = "18;54"
.ListWidth = (18 + 54)
End With
Call ListeDüzenle
End Sub
Private Sub ComboBox1_Change()
On Error Resume Next
Label1.Caption = " " & ComboBox1.List(ComboBox1.ListIndex, 1)
End Sub
Private Sub CommandButton1_Click()
On Error Resume Next
Tip = ComboBox1.Value
YeniEleman = TextBox1.Value
If Tip <> "" And YeniEleman <> "" Then
Sheets.Add , Sheets(Worksheets.Count), , VBA.Val(Tip)
Call ListeDüzenle
End If
End Sub
Sub ListeDüzenle()
On Error Resume Next
ListBox1.Clear
For Each Eleman In Application.VBE.ActiveVBProject.vbComponents
ListBox1.AddItem Eleman.Name
Next Eleman
End Sub

Blog Arşivi

Gadget

Bu içerik henüz şifreli bağlantı üzerinden kullanılamıyor.

Bu Blogda Ara

Contributor

Contributor
Mustafa ULUSARAÇ İstanbul, TÜRKİYE
free counters
T. C. Central Bank Indicative Exchange Rates
Currency Exchange Rate Widget,Currency Converter Widget
Borsa İstanbul
Anadolu Üniversitesi Açık Öğretim Fakültesi