(آموزشی) کپی از لیست باکس

Collapse
X
 
  • زمان
  • نمایش
حذف همه
new posts
  • ali.b

    • 2014/01/12
    • 798

    (آموزشی) کپی از لیست باکس

    سلام
    برای کپی مقادیر درج شده در لیست باکس میتوان از کد زیر استفاده نمود .ضمنا همون طور که در گد مشخص هست در صورت نیاز می توانید فقط ستون ها مد نظر رو انتخاب کنید
    کد:
    Dim lngItem As Long    
    For lngItem = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(lngItem) Then
                With Sheet2
                    .Cells(.Rows.Count, "B").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 0)
                    .Cells(.Rows.Count, "C").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 1)
                    .Cells(.Rows.Count, "D").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 2)
                    .Cells(.Rows.Count, "E").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 3)
                    .Cells(.Rows.Count, "F").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 4)
                    .Cells(.Rows.Count, "G").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 5)
                    .Cells(.Rows.Count, "H").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 6)
                    .Cells(.Rows.Count, "I").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 7)
                    .Cells(.Rows.Count, "J").End(xlUp).Offset(1).Value = ListBox1.list(lngItem, 8)
                    
                End With
            End If
        Next lngItem
    [CENTER]
    [/CENTER]
چند لحظه..