jeudi 7 mai 2015

Using userform and if conditions to select values and paste them

I have an userform that works ok, now I want to make a report using the userform selected values. I tried, it gives me no error but it doesnt paste any value, I guess there is a problem with the if conditions.... dont know how to make these question more clear..

  For i = 0 To ListBox2.ListCount - 1
    If ListBox2.Selected(i) Then
  Dim j As Integer

    Dim SizeOfPlayerGuessList As Integer

   SizeOfPlayerGuessList =    Worksheets("Info").Cells.SpecialCells(xlLastCell).Row
 For j = 1 To Cells(SizeOfPlayerGuessList, 1).End(xlUp).Row


 If Worksheets("info").Range("B1").Offset(j, 0).Value = ListBox2.Selected(i) Then
  Worksheets("info").Range("B1").Offset(j, 0).EntireRow.Copy
  Dim p As String
 p = Worksheets("info").Range("B1").Offset(j, -1).Value
    ActiveSheet.Range("A1").Select
      With ActiveSheet.Range("A:A")
   Set k = .Find(p, LookIn:=xlValues)
    If k Is Nothing Then
   fila = 2
   While Cells(fila, 1).Value <> ""
   fila = fila + 1
    Wend
    Cells(fila, 1).PasteSpecial xlPasteValues
     End If

       End With

        End If
        Next j
    End If
   Next i

Aucun commentaire:

Enregistrer un commentaire