- Katılım
- 10 Şubat 2018
- Mesajlar
- 1
- Excel Vers. ve Dili
- excell-2016 ingilizce
Merhaba,
Basit bir makro oluşturdum, Bir excell dosyası içinde 3 kitap var. Makro oluşturunca. 3 kitapda birden çalışmıyor. Neden olabilir ?
örnek 1 kitapta üç isim var, yanlarında yaşları yazıyor. 2. kitapya aynı 3 isim var yaşları yazıyor. 3. kitapta 3 isim var yaşları yazıyor.
Aynı excell için kitapların adı , x,y,z.
ben ctrl + x basınca otomatik olarak büyükten küçüğe isimleri sıralasın istiyor. 3 kitapta birden.
ub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+x
'
Range("A1:B1").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("y").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("y").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("y").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("x").Select
Range("K6").Select
Selection.AutoFilter
Range("A1:B1").Select
Range("B1").Activate
Selection.AutoFilter
ActiveWorkbook.Worksheets("x").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("x").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("x").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("z").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("z").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("z").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("z").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
Sheets("y").Select
Selection.AutoFilter
Sheets("x").Select
Selection.AutoFilter
End Sub
Basit bir makro oluşturdum, Bir excell dosyası içinde 3 kitap var. Makro oluşturunca. 3 kitapda birden çalışmıyor. Neden olabilir ?
örnek 1 kitapta üç isim var, yanlarında yaşları yazıyor. 2. kitapya aynı 3 isim var yaşları yazıyor. 3. kitapta 3 isim var yaşları yazıyor.
Aynı excell için kitapların adı , x,y,z.
ben ctrl + x basınca otomatik olarak büyükten küçüğe isimleri sıralasın istiyor. 3 kitapta birden.
ub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+x
'
Range("A1:B1").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("y").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("y").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("y").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("x").Select
Range("K6").Select
Selection.AutoFilter
Range("A1:B1").Select
Range("B1").Activate
Selection.AutoFilter
ActiveWorkbook.Worksheets("x").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("x").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("x").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("z").Select
Selection.AutoFilter
ActiveWorkbook.Worksheets("z").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("z").AutoFilter.Sort.SortFields.Add Key:=Range("B1" _
), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("z").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Selection.AutoFilter
Sheets("y").Select
Selection.AutoFilter
Sheets("x").Select
Selection.AutoFilter
End Sub
