[]
makro sevenler-bütün sheetlerde çalışan makro
Merhaba arkadaşlar,
bir workbookta sheet1,sheet1(2),sheet1(3)olarak giden sheetlerim var.
aşağıdaki makronun bütün sheetlerde çalışmasını istiyorum tire ile belirttiğim kısımlarda hata veriyor. (diğer kısımlara henüz bakamadım zaten )
Sub ALSAT()
Dim WS_Count As Integer
Dim I As Integer
Dim N As Long
N = ActiveSheet.Rows.Count
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
--- With Sheets("1" & I)---
----Range("E1").Select
ActiveSheet.Range("A:E").AutoFilter Field:=5, Criteria1:="GRM"-----
Range("C1").Select
ActiveSheet.AutoFilter.Sort.SortFields.Clear
ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range _
("C1:C&N"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]=""A"",""AL"",""SAT"")"
Range("F2").Select
Selection.Copy
Range("F&N").Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
End With
Next I
End Sub
bir workbookta sheet1,sheet1(2),sheet1(3)olarak giden sheetlerim var.
aşağıdaki makronun bütün sheetlerde çalışmasını istiyorum tire ile belirttiğim kısımlarda hata veriyor. (diğer kısımlara henüz bakamadım zaten )
Sub ALSAT()
Dim WS_Count As Integer
Dim I As Integer
Dim N As Long
N = ActiveSheet.Rows.Count
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
--- With Sheets("1" & I)---
----Range("E1").Select
ActiveSheet.Range("A:E").AutoFilter Field:=5, Criteria1:="GRM"-----
Range("C1").Select
ActiveSheet.AutoFilter.Sort.SortFields.Clear
ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range _
("C1:C&N"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]=""A"",""AL"",""SAT"")"
Range("F2").Select
Selection.Copy
Range("F&N").Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
End With
Next I
End Sub
- kisa (13.11.14 08:23:36 ~ 08:24:10)
şöyle olabilir belki:
Sub ALSAT()
Dim WS_Count As Integer
Dim I As Integer
Dim N As Long
N = ActiveSheet.Rows.Count
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
ThisWorkbook.Sheets(I).Select
Range("E1").Select
ActiveSheet.Range("A:E").AutoFilter Field:=5, Criteria1:="GRM"
Range("C1").Select
ActiveSheet.AutoFilter.Sort.SortFields.Clear
ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range _
("C1:C&N"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]=""A"",""AL"",""SAT"")"
Range("F2").Select
Selection.Copy
Range("F&N").Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
Next I
End Sub
Sub ALSAT()
Dim WS_Count As Integer
Dim I As Integer
Dim N As Long
N = ActiveSheet.Rows.Count
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
ThisWorkbook.Sheets(I).Select
Range("E1").Select
ActiveSheet.Range("A:E").AutoFilter Field:=5, Criteria1:="GRM"
Range("C1").Select
ActiveSheet.AutoFilter.Sort.SortFields.Clear
ActiveSheet.AutoFilter.Sort.SortFields.Add Key:=Range _
("C1:C&N"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
Range("F2").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-5]=""A"",""AL"",""SAT"")"
Range("F2").Select
Selection.Copy
Range("F&N").Select
ActiveSheet.Paste
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
Next I
End Sub
- lemmiwinks (13.11.14 08:38:38)
1