• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

userform aktarılacak hücre yerini değiştirme

  • Konbuyu başlatan Konbuyu başlatan aydgur
  • Başlangıç tarihi Başlangıç tarihi

aydgur

Altın Üye
Katılım
31 Ekim 2005
Mesajlar
455
Excel Vers. ve Dili
Excel 2007 Türkçe
Private Sub CommandButton2_Click()
Dim iListCount As Integer, iColCount As Integer
Dim iRow As Integer
Dim rStartCell As Range
Set rStartCell = Sheets("T_680").Range("B2").End(xlUp).Offset(1, 0)
For iListCount = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(iListCount) = True Then
ListBox1.Selected(iListCount) = False
iRow = iRow + 1
For iColCount = 0 To Range("AÇIK!A2:J2000").Columns.Count - 1
rStartCell.Cells(iRow, iColCount + 1).Value = _
ListBox1.List(iListCount, iColCount)
Next iColCount
End If
Next iListCount
Set rStartCell = Nothing
UserForm2.Show
End Sub
Bu kodda ("T_680")sayfasının B2 den itibaren değilde ilk boş satırdan itibaren nasıl yapabilirim
 
Selamlar,

Aşağıdaki satırı bir sonraki kırmızı renkli satır ile değiştirip denermisiniz.

Kod:
Set rStartCell = Sheets("T_680").Range("B65536").End(3).Offset(1, 0)

Kod:
[B][COLOR=red]Set rStartCell = Sheets("T_680").Range("B65536").End(3).Offset(1, 0)[/COLOR][/B]
 
teşekkür ederim .Peki userform a aktarırken sadece K sutunu boş olanları nasıl ekleyebilirim ?
 
Selamlar,

Sorunuzu örnek dosya ekleyerek açıklarsanız daha sağlıklı olacaktır.
 
rivate Sub UserForm_Initialize()
ListBox1.RowSource = "AÇIK!A2:J2000"
ListBox1.ColumnCount = 10
ListBox1.ColumnWidths = 30 & ";" & 60 & ";" & 60 & ";" & 60 & ";" & 40 & ";" & 40
ListBox1.ColumnHeads = False
End Sub
Bu kodda AÇIK sayfasının A2:J2000 arası yerine ;eğer K sütunu boşsa A2:A2000 yapabilirmiyim
 
Selamlar,

Aşağıdaki şekilde denermisiniz.

Kod:
Private Sub UserForm_Initialize()
    If WorksheetFunction.CountA(Sheets("AÇIK").Columns("K")) = 0 Then
    ListBox1.RowSource = "AÇIK!A2:A2000"
    ListBox1.ColumnCount = 1
    ListBox1.ColumnWidths = 30
    ListBox1.ColumnHeads = False
    Else
    ListBox1.RowSource = "AÇIK!A2:J2000"
    ListBox1.ColumnCount = 10
    ListBox1.ColumnWidths = 30 & ";" & 60 & ";" & 60 & ";" & 60 & ";" & 40 & ";" & 40
    ListBox1.ColumnHeads = False
    End If
End Sub
 
Geri
Üst