- Katılım
- 7 Aralık 2010
- Mesajlar
- 9
- Excel Vers. ve Dili
- Excel 2003
Merhaba Üstadlar,
Makroya yeni başladığım için aşağıdaki gibi bir makroda basit bir şey sormak istiyorum.
Kırmızı ile yazılan Target, G3 için target'ı başka bir sayfadan seçmek istiyorum. G3 yerine Sayfa 2deki C3 hücresi gibi.
Bunu nasıl yapabilirim?
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [G3]) Is Nothing Then Exit Sub
Dim s2 As Worksheet
Dim i As Long
Dim c As Range
Dim Adr As String
Set s2 = Sheets("Plan")
Range("AJ4:AN60").ClearContents
i = 3
With s2.Range("g:g")
Set c = .Find(Target.Value, LookIn:=xlValues)
If Not c Is Nothing Then
Adr = c.Address
Do
i = i + 1
Cells(i, "AJ") = s2.Cells(c.Row, "C")
Cells(i, "AK") = s2.Cells(c.Row, "D")
Cells(i, "AL") = s2.Cells(c.Row, "E")
Cells(i, "AM") = s2.Cells(c.Row, "F")
Cells(i, "AN") = s2.Cells(c.Row, "H")
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End With
End Sub
Makroya yeni başladığım için aşağıdaki gibi bir makroda basit bir şey sormak istiyorum.
Kırmızı ile yazılan Target, G3 için target'ı başka bir sayfadan seçmek istiyorum. G3 yerine Sayfa 2deki C3 hücresi gibi.
Bunu nasıl yapabilirim?
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [G3]) Is Nothing Then Exit Sub
Dim s2 As Worksheet
Dim i As Long
Dim c As Range
Dim Adr As String
Set s2 = Sheets("Plan")
Range("AJ4:AN60").ClearContents
i = 3
With s2.Range("g:g")
Set c = .Find(Target.Value, LookIn:=xlValues)
If Not c Is Nothing Then
Adr = c.Address
Do
i = i + 1
Cells(i, "AJ") = s2.Cells(c.Row, "C")
Cells(i, "AK") = s2.Cells(c.Row, "D")
Cells(i, "AL") = s2.Cells(c.Row, "E")
Cells(i, "AM") = s2.Cells(c.Row, "F")
Cells(i, "AN") = s2.Cells(c.Row, "H")
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Adr
End If
End With
End Sub
