- Katılım
- 4 Mayıs 2007
- Mesajlar
- 113
- Excel Vers. ve Dili
- 2003 2007 türkçe
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Option Explicit
Sub DOSYA_NO_EKLE()
Dim Hücre1 As Range, Hücre2 As Range, Dosya_No As Integer
Dim İlk_Ayraç As Byte, Son_Ayraç As Byte
Columns("A:A").Insert Shift:=xlToRight
For Each Hücre1 In Columns("B:B").SpecialCells(xlCellTypeConstants, 23)
If InStr(1, Hücre1.Value, "Dosya No") > 0 Then
İlk_Ayraç = InStr(1, Hücre1.Value, ":") + 1
Son_Ayraç = Len(Hücre1.Value) - InStr(1, Hücre1.Value, ":")
Dosya_No = Mid(Replace(Hücre1.Value, ".", ","), İlk_Ayraç, Son_Ayraç)
For Each Hücre2 In Range("B" & Hücre1.Row, "B" & Cells(Hücre1.Row, 2).End(4).Row)
Cells(Hücre2.Row, 1) = Dosya_No
Next
End If
Next
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
Selamlar,
Aşağıdaki kodu denermisiniz.
Kod:Option Explicit Sub DOSYA_NO_EKLE() Dim Hücre1 As Range, Hücre2 As Range, Dosya_No As Integer Dim İlk_Ayraç As Byte, Son_Ayraç As Byte Columns("A:A").Insert Shift:=xlToRight For Each Hücre1 In Columns("B:B").SpecialCells(xlCellTypeConstants, 23) If InStr(1, Hücre1.Value, "Dosya No") > 0 Then İlk_Ayraç = InStr(1, Hücre1.Value, ":") + 1 Son_Ayraç = Len(Hücre1.Value) - InStr(1, Hücre1.Value, ":") Dosya_No = Mid(Replace(Hücre1.Value, ".", ","), İlk_Ayraç, Son_Ayraç) For Each Hücre2 In Range("B" & Hücre1.Row, "B" & Cells(Hücre1.Row, 2).End(4).Row) Cells(Hücre2.Row, 1) = Dosya_No Next End If Next MsgBox "İşleminiz tamamlanmıştır.", vbInformation End Sub
Option Explicit
Sub SEÇİLEN_DOSYAYA_DOSYA_NO_EKLE()
Dim Dosya As Variant, Kaynak_Dosya As Workbook
Dim Hücre1 As Range, Hücre2 As Range, Dosya_No As Integer
Dim İlk_Ayraç As Byte, Son_Ayraç As Byte
Dosya = Application.GetOpenFilename("Excel Dosyası (*.xls),*.xls", , "Excel Dosyasını Seçin")
If Dosya = False Then
MsgBox "İşleme devam edebilmek için lütfen bir excel dosyası seçiniz !", vbExclamation, "Dikkat !"
Exit Sub
End If
Application.ScreenUpdating = False
Set Kaynak_Dosya = Workbooks.Open(Dosya, False, False)
With Kaynak_Dosya.Sheets(1)
.Columns("A:A").Insert Shift:=xlToRight
For Each Hücre1 In .Columns("B:B").SpecialCells(xlCellTypeConstants, 23)
If InStr(1, Hücre1.Value, "Dosya No") > 0 Then
İlk_Ayraç = InStr(1, Hücre1.Value, ":") + 1
Son_Ayraç = Len(Hücre1.Value) - InStr(1, Hücre1.Value, ":")
Dosya_No = Mid(Replace(Hücre1.Value, ".", ","), İlk_Ayraç, Son_Ayraç)
For Each Hücre2 In .Range("B" & Hücre1.Row, "B" & Cells(Hücre1.Row, 2).End(4).Row)
.Cells(Hücre2.Row, 1) = Dosya_No
Next
End If
Next
Kaynak_Dosya.Close True
End With
Application.ScreenUpdating = True
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub
Option Explicit
Sub SEÇİLEN_DOSYAYA_DOSYA_NO_EKLE()
Dim Dosya As Variant, Kaynak_Dosya As Workbook
Dim Hücre1 As Range, Hücre2 As Range, X As Long, Dosya_No As Integer
Dim İlk_Ayraç As Byte, Son_Ayraç As Byte
Dosya = Application.GetOpenFilename("Excel Dosyası (*.xls),*.xls", , "Excel Dosyasını Seçin")
If Dosya = False Then
MsgBox "İşleme devam edebilmek için lütfen bir excel dosyası seçiniz !", vbExclamation, "Dikkat !"
Exit Sub
End If
Application.ScreenUpdating = False
Set Kaynak_Dosya = Workbooks.Open(Dosya, False, False)
With Kaynak_Dosya.Sheets(1)
.Columns("A:A").Insert Shift:=xlToRight
For Each Hücre1 In .Columns("B:B").SpecialCells(xlCellTypeConstants, 23)
If InStr(1, Hücre1.Value, "Dosya No") > 0 Then
İlk_Ayraç = InStr(1, Hücre1.Value, ":") + 1
Son_Ayraç = Len(Hücre1.Value) - InStr(1, Hücre1.Value, ":")
Dosya_No = Mid(Replace(Hücre1.Value, ".", ","), İlk_Ayraç, Son_Ayraç)
For Each Hücre2 In .Range("B" & Hücre1.Row, "B" & Cells(Hücre1.Row, 2).End(4).Row)
.Cells(Hücre2.Row, 1) = Dosya_No
Next
End If
Next
For X = 5 To 1 Step -1
If .Cells(X, 2).Interior.ColorIndex = 15 And InStr(1, .Cells(X, 2), "Sıra No") = 0 Then .Rows(X).EntireRow.Delete
Next
For X = .Range("B65536").End(3).Row To 3 Step -1
If .Cells(X, 2).Interior.ColorIndex = 15 Then .Rows(X).EntireRow.Delete
Next
Kaynak_Dosya.Close True
End With
Application.ScreenUpdating = True
MsgBox "İşleminiz tamamlanmıştır.", vbInformation
End Sub