Arkadaşlar merhaba.
Siteden ihtiyaçlarım ile ilgili arama makrosu ararken bir makro buldum.
Fakat şöyle bir sıkıntım var. Makroyu çalıştırdığımda R sütunun başından yazmaya başlıyor. Ben örneğin 16. satırdan başlasın istiyorum. Nasıl yaparım?
Private Sub ComboBox1_Change()
End Sub
Private Sub CommandButton1_Click()
Dim s1 As Worksheet, s2 As Worksheet, sat As Long, sat2 As Long
Dim hcr As Range
If ComboBox1.Value = "" Then Exit Sub
Set s1 = Sheets("Sayfa 1")
Set s2 = Sheets("Sayfa 2")
sat = s1.Cells(65536, "C").End(xlUp).Row
sat2 = s2.Cells(65536, "R").End(xlUp).Row + 1
For Each hcr In s1.Range("C2:J" & sat)
If hcr.Value = CDate(ComboBox1.Value) Then
s2.Range("Q" & sat2) = sat2 - 1
s2.Range("R" & sat2 & ":X" & sat2).Value = s1.Range("C" & hcr.Row & ":J" & hcr.Row).Value
sat2 = sat2 + 1
End If
Next
End Sub
Private Sub UserForm_Initialize()
Set s1 = Sheets("Sayfa 2")
For a = 11 To s1.[C65535].End(3).Row
V = 0
mah = Trim(s1.Cells(a, "C"))
For b = 0 To ComboBox1.ListCount - 1
If ComboBox1.List(b) = mah Then
V = 1
GoTo atla
End If
Next
atla:
If V <> 1 Then
ComboBox1.AddItem mah
End If
V = 0
Next
End Sub
Siteden ihtiyaçlarım ile ilgili arama makrosu ararken bir makro buldum.
Fakat şöyle bir sıkıntım var. Makroyu çalıştırdığımda R sütunun başından yazmaya başlıyor. Ben örneğin 16. satırdan başlasın istiyorum. Nasıl yaparım?
Private Sub ComboBox1_Change()
End Sub
Private Sub CommandButton1_Click()
Dim s1 As Worksheet, s2 As Worksheet, sat As Long, sat2 As Long
Dim hcr As Range
If ComboBox1.Value = "" Then Exit Sub
Set s1 = Sheets("Sayfa 1")
Set s2 = Sheets("Sayfa 2")
sat = s1.Cells(65536, "C").End(xlUp).Row
sat2 = s2.Cells(65536, "R").End(xlUp).Row + 1
For Each hcr In s1.Range("C2:J" & sat)
If hcr.Value = CDate(ComboBox1.Value) Then
s2.Range("Q" & sat2) = sat2 - 1
s2.Range("R" & sat2 & ":X" & sat2).Value = s1.Range("C" & hcr.Row & ":J" & hcr.Row).Value
sat2 = sat2 + 1
End If
Next
End Sub
Private Sub UserForm_Initialize()
Set s1 = Sheets("Sayfa 2")
For a = 11 To s1.[C65535].End(3).Row
V = 0
mah = Trim(s1.Cells(a, "C"))
For b = 0 To ComboBox1.ListCount - 1
If ComboBox1.List(b) = mah Then
V = 1
GoTo atla
End If
Next
atla:
If V <> 1 Then
ComboBox1.AddItem mah
End If
V = 0
Next
End Sub
