- Katılım
- 3 Ekim 2007
- Mesajlar
- 25
- Excel Vers. ve Dili
- excel_2003
arkadaşlar bir çok firmaların kayıtlı olduğu excel dosyası elimde mevcut. ben bu firmaları firma ismine göre farklı bi excel sayfasına aktarmak istiyorum. yardımlarınızı bekliyorum.
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
RSE002filitleyerek baska sheetlere ayırma makrosu
yukarıdaki konu baslıgını incelermisiniz.
Option Explicit
Sub Sayfalara_Ayirmak()
Dim col As New Collection
Dim shF As Worksheet, _
shT As Worksheet, _
bul As Range
Dim i%, j%, k%, son%
Dim adres As String
Set shF = Sheets("FİRMALAR")
On Error Resume Next
For i = 2 To shF.Cells(65536, 1).End(xlUp).Row
col.Add shF.Cells(i, 1), shF.Cells(i, 1)
Next i
On Error GoTo 0
For i = 1 To col.Count
Set shT = Sheets.Add(after:=Sheets(Sheets.Count))
shT.Name = col.Item(i)
shT.Range("A1:E1").Value = shF.Range("A1:E1").Value
Set bul = shF.Columns(1).Find(col.Item(i), Lookat:=xlWhole)
If Not bul Is Nothing Then
adres = bul.Address
Do
son = shT.Cells(65536, 1).End(xlUp).Row + 1
For k = 1 To 5
shT.Cells(son, k) = shF.Cells(bul.Row, k)
Next k
Set bul = shF.Columns(1).FindNext(bul)
Loop While Not bul Is Nothing And adres <> bul.Address
End If
Next i
shF.Select
Set bul = Nothing
Set shT = Nothing
Set shF = Nothing
End Sub
Sub Kitaplara_Ayirmak()
Dim klasor
Dim dizin As String
Dim col As New Collection
Dim shF As Worksheet, _
shT As Worksheet, _
wbB As Workbook, _
wbT As Workbook, _
bul As Range
Dim i%, j%, k%, son%
Dim adres As String
Set klasor = CreateObject("Shell.Application").BrowseForFolder(0, "Lütfen bir klasör seçin !", &H100)
If klasor Is Nothing Then
MsgBox "Herhangi bir klasör seçmediniz", vbCritical, "UYARI"
Exit Sub
Else
dizin = klasor.self.Path
End If
Set wbB = ThisWorkbook
Set shF = wbB.Sheets("FİRMALAR")
On Error Resume Next
For i = 2 To shF.Cells(65536, 1).End(xlUp).Row
col.Add shF.Cells(i, 1), shF.Cells(i, 1)
Next i
On Error GoTo 0
Application.ScreenUpdating = False
For i = 1 To col.Count
Set wbT = Workbooks.Add
Set shT = wbT.ActiveSheet
shT.Name = col.Item(i)
shT.Range("A1:E1").Value = shF.Range("A1:E1").Value
Set bul = shF.Columns(1).Find(col.Item(i), Lookat:=xlWhole)
If Not bul Is Nothing Then
adres = bul.Address
Do
son = shT.Cells(65536, 1).End(xlUp).Row + 1
For k = 1 To 5
shT.Cells(son, k) = shF.Cells(bul.Row, k)
Next k
Set bul = shF.Columns(1).FindNext(bul)
Loop While Not bul Is Nothing And adres <> bul.Address
End If
Application.DisplayAlerts = False
wbT.SaveAs dizin & Application.PathSeparator & col.Item(i) & ".xls"
Application.DisplayAlerts = True
wbT.Close 0
Next i
Application.ScreenUpdating = True
Set bul = Nothing
Set shT = Nothing
Set shF = Nothing
Set wbB = Nothing
Set wbT = Nothing
Set brw = Nothing
End Sub