22 Nisan 2017 Cumartesi

Workbook, ActiveWorkBook ve ThisWorkbook Nesneleri

Workbook, ActiveWorkBook ve ThisWorkbook Nesneleri:

ActiveWorkbook: Aktif olan çalışma dosyası (görünen).
Workbooks(1): Açık olanlardan birincisi
ThisWorkbook: Kodlara ev sahipliği yapan çalışma dosyası
Sheets("FC"): FC adlı sheet
ActiveWorkSheet: Bulunulan/işlenen sheet

Sheets(1): Sağa doğru 1. Sıradaki sheet

19 Nisan 2017 Çarşamba

BALL PACKAGING firmasında bilişim eğitimleri projemiz


Excel VBA - sütundaki verilerin tümünü işlemek

Her satır arasına boş bir satır ekleyen kodlama için aşağıda yer alan döngü türlerini inceleyiniz.


Sub dongu1()
 ' HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A" & Rows.Count).End(xlUp).Row

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next

End Sub


Sub Dongu2()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer
satir = 1

For Each cell In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

satir = satir + 1

Next

End Sub

Sub dongu3()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.


Dim satir As Integer
satir = 1

Do
If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

satir = satir + 1

Loop Until Cells(satir, 1).Value = ""

End Sub



Sub Dongu4()
 ' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A1", Range("A1").End(xlDown)).Rows.Count

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next

End Sub


Sub Dongu5()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A1048576").End(xlUp).Row

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next


End Sub
Sub Dongu6()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer


For satir = 1 To Range("A1").End(xlDown).Row
If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If
Next


End Sub

Excel VBA döngüler (loops)

Her satır arasına boş bir satır ekleyen kodlama için aşağıda yer alan döngü türlerini inceleyiniz.


Sub dongu1()
 ' HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A" & Rows.Count).End(xlUp).Row

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next

End Sub


Sub Dongu2()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer
satir = 1

For Each cell In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

satir = satir + 1

Next

End Sub

Sub dongu3()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.


Dim satir As Integer
satir = 1

Do
If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

satir = satir + 1

Loop Until Cells(satir, 1).Value = ""

End Sub



Sub Dongu4()
 ' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A1", Range("A1").End(xlDown)).Rows.Count

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next

End Sub


Sub Dongu5()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer

For satir = 1 To Range("A1048576").End(xlUp).Row

If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If

Next


End Sub
Sub Dongu6()
' FC sheet HER SATIRDAN SONRA bir satır boş satır ekelenecek.
Dim satir As Integer


For satir = 1 To Range("A1").End(xlDown).Row
If satir Mod 2 Then
' yeni satır ekle
Rows(satir).EntireRow.Insert
End If
Next


End Sub