Merhaba.
Başka excel dosyasındaki bir sayfadan vba için veri çekmek istiyorum. fakat kod bölümüne nasıl yazacağım. aşağıdaki gibi yazdığımda Run-tıme error "9" hatası veriyor. Hata neden kaynaklanıyor.
Private Sub Worksheet_Activate():
Dim sat As Long, i As Long, sat1 As Long, sat2 As Long
Set S1 = ThisWorkbook.Worksheets("E:\FIRAT\ORTAK\[KADRO TAKİP 2014.xlsx]eleman")
Set s2 = ThisWorkbook.Worksheets("sayfa2")
s2.Range("B5:T" & Rows.Count).ClearContents
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
sat = S1.Cells(Rows.Count, "F").End(xlUp).Row
sat1 = 5
sat2 = 5
For i = 2 To sat
If S1.Cells(i, "K").Value = s2.Cells(1, "C").Value Then
s2.Cells(sat1, "B") = sat1 - 4
s2.Cells(sat1, "C").Value = S1.Cells(i, "A").Value
s2.Cells(sat1, "D").Value = S1.Cells(i, "B").Value
s2.Cells(sat1, "E").Value = S1.Cells(i, "H").Value
s2.Cells(sat1, "F").Value = S1.Cells(i, "I").Value
s2.Cells(sat1, "G").Value = S1.Cells(i, "K").Value
s2.Cells(sat1, "H").Value = S1.Cells(i, "O").Value
s2.Cells(sat1, "I").Value = "Oryantasyon Bitti"
sat1 = sat1 + 1
End If
If S1.Cells(i, "K").Value = s2.Cells(1, "D").Value Then
s2.Cells(sat2, "K") = sat2 - 4
s2.Cells(sat2, "L").Value = S1.Cells(i, "A").Value
s2.Cells(sat2, "M").Value = S1.Cells(i, "B").Value
s2.Cells(sat2, "N").Value = S1.Cells(i, "H").Value
s2.Cells(sat2, "O").Value = S1.Cells(i, "I").Value
s2.Cells(sat2, "P").Value = S1.Cells(i, "K").Value
s2.Cells(sat2, "Q").Value = S1.Cells(i, "O").Value
s2.Cells(sat2, "R").Value = "Deneme Süresi Bitti"
sat2 = sat2 + 1
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Range("B5:T65536").Select
Selection.ClearContents
Range("A1").Select
End Sub
Başka excel dosyasındaki bir sayfadan vba için veri çekmek istiyorum. fakat kod bölümüne nasıl yazacağım. aşağıdaki gibi yazdığımda Run-tıme error "9" hatası veriyor. Hata neden kaynaklanıyor.
Private Sub Worksheet_Activate():
Dim sat As Long, i As Long, sat1 As Long, sat2 As Long
Set S1 = ThisWorkbook.Worksheets("E:\FIRAT\ORTAK\[KADRO TAKİP 2014.xlsx]eleman")
Set s2 = ThisWorkbook.Worksheets("sayfa2")
s2.Range("B5:T" & Rows.Count).ClearContents
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
sat = S1.Cells(Rows.Count, "F").End(xlUp).Row
sat1 = 5
sat2 = 5
For i = 2 To sat
If S1.Cells(i, "K").Value = s2.Cells(1, "C").Value Then
s2.Cells(sat1, "B") = sat1 - 4
s2.Cells(sat1, "C").Value = S1.Cells(i, "A").Value
s2.Cells(sat1, "D").Value = S1.Cells(i, "B").Value
s2.Cells(sat1, "E").Value = S1.Cells(i, "H").Value
s2.Cells(sat1, "F").Value = S1.Cells(i, "I").Value
s2.Cells(sat1, "G").Value = S1.Cells(i, "K").Value
s2.Cells(sat1, "H").Value = S1.Cells(i, "O").Value
s2.Cells(sat1, "I").Value = "Oryantasyon Bitti"
sat1 = sat1 + 1
End If
If S1.Cells(i, "K").Value = s2.Cells(1, "D").Value Then
s2.Cells(sat2, "K") = sat2 - 4
s2.Cells(sat2, "L").Value = S1.Cells(i, "A").Value
s2.Cells(sat2, "M").Value = S1.Cells(i, "B").Value
s2.Cells(sat2, "N").Value = S1.Cells(i, "H").Value
s2.Cells(sat2, "O").Value = S1.Cells(i, "I").Value
s2.Cells(sat2, "P").Value = S1.Cells(i, "K").Value
s2.Cells(sat2, "Q").Value = S1.Cells(i, "O").Value
s2.Cells(sat2, "R").Value = "Deneme Süresi Bitti"
sat2 = sat2 + 1
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton2_Click()
Range("B5:T65536").Select
Selection.ClearContents
Range("A1").Select
End Sub
