Notifications
Clear all

Resumir código

2 Posts
2 Usuários
0 Reactions
1,090 Visualizações
victorsam
(@victorsam)
Posts: 110
Estimable Member
Topic starter
 

Pessoa encontrei esse código que localiza um item em uma coluna e pega o o item da coluna a frente na LISTVIEW.

Só que o estou achando o código muito pesado ao chama e eu preciso de 3 sequências dessas.

Ta funcionando normal mais ta muito pesado, alguem poderia ver se tem algum erro ou poderia melhorar ou outro código melhor.

desde já agradeço valew.

Dim adr8, adr83, adr9, adr93, adr10, adr103, adr11, adr113, adr12, adr123, adr13, adr133, adr14, adr143, adr15, adr153, adr16, adr163, adr17, adr173, adr18, adr183, adr19, adr193 As ListItem


With Me
    .txtclient8 = ""
    .txtserv8 = ""
    .txtclient83 = ""
    .txtserv83 = ""
    .txtclient9.Text = ""
    .txtserv9.Text = ""
    .txtclient93.Text = ""
    .txtserv93.Text = ""
    .txtclient10.Text = ""
    .txtserv10.Text = ""
    .txtclient103.Text = ""
    .txtserv103.Text = ""
    .txtclient11.Text = ""
    .txtserv11.Text = ""
    .txtclient113.Text = ""
    .txtserv113.Text = ""
    .txtclient12.Text = ""
    .txtserv12.Text = ""
    .txtclient123.Text = ""
    .txtserv123.Text = ""
    .txtclient13.Text = ""
    .txtserv13.Text = ""
    .txtclient133.Text = ""
    .txtserv133.Text = ""
    .txtclient14.Text = ""
    .txtserv14.Text = ""
    .txtclient143.Text = ""
    .txtserv143.Text = ""
    .txtclient15.Text = ""
    .txtserv15.Text = ""
    .txtclient153.Text = ""
    .txtserv153.Text = ""
    .txtclient16.Text = ""
    .txtserv16.Text = ""
    .txtclient163.Text = ""
    .txtserv163.Text = ""
    .txtclient17.Text = ""
    .txtserv17.Text = ""
    .txtclient173.Text = ""
    .txtserv173.Text = ""
    .txtclient18.Text = ""
    .txtserv18.Text = ""
    .txtclient183.Text = ""
    .txtserv183.Text = ""
    .txtclient19.Text = ""
    .txtserv19.Text = ""
    .txtclient193.Text = ""
    .txtserv193.Text = ""
End With


For Each adr8 In lvwadriana.ListItems
If adr8.SubItems(2) = "08:00" Then
    txtclient8.Text = adr8.SubItems(3)
    txtserv8.Text = adr8.SubItems(4)
    Exit For
End If


For Each adr83 In lvwadriana.ListItems
If adr83.SubItems(2) = "08:30" Then
    txtclient83.Text = adr83.SubItems(3)
    txtserv83.Text = adr83.SubItems(4)
    Exit For
End If


For Each adr9 In lvwadriana.ListItems
If adr9.SubItems(2) = "09:00" Then
    txtclient9.Text = adr9.SubItems(3)
    txtserv9.Text = adr9.SubItems(4)
    Exit For
End If

For Each adr93 In lvwadriana.ListItems
If adr93.SubItems(2) = "09:30" Then
    txtclient93.Text = adr93.SubItems(3)
    txtserv93.Text = adr93.SubItems(4)
    Exit For
End If

For Each adr10 In lvwadriana.ListItems
If adr10.SubItems(2) = "10:00" Then
    txtclient10.Text = adr10.SubItems(3)
    txtserv10.Text = adr10.SubItems(4)
    Exit For
End If

For Each adr103 In lvwadriana.ListItems
If adr103.SubItems(2) = "10:30" Then
    txtclient103.Text = adr103.SubItems(3)
    txtserv103.Text = adr103.SubItems(4)
    Exit For
End If

For Each adr11 In lvwadriana.ListItems
If adr11.SubItems(2) = "11:00" Then
    txtclient11.Text = adr11.SubItems(3)
    txtserv11.Text = adr11.SubItems(4)
    Exit For
End If

For Each adr113 In lvwadriana.ListItems
If adr113.SubItems(2) = "11:30" Then
    txtclient113.Text = adr113.SubItems(3)
    txtserv113.Text = adr113.SubItems(4)
    Exit For
End If

For Each adr12 In lvwadriana.ListItems
If adr12.SubItems(2) = "12:00" Then
    txtclient12.Text = adr12.SubItems(3)
    txtserv12.Text = adr12.SubItems(4)
    Exit For
End If

For Each adr123 In lvwadriana.ListItems
If adr123.SubItems(2) = "12:30" Then
    txtclient123.Text = adr123.SubItems(3)
    txtserv123.Text = adr123.SubItems(4)
    Exit For
End If

For Each adr13 In lvwadriana.ListItems
If adr13.SubItems(2) = "13:00" Then
    txtclient13.Text = adr13.SubItems(3)
    txtserv13.Text = adr13.SubItems(4)
    Exit For
End If

For Each adr133 In lvwadriana.ListItems
If adr133.SubItems(2) = "13:30" Then
    txtclient133.Text = adr133.SubItems(3)
    txtserv133.Text = adr133.SubItems(4)
    Exit For
End If

For Each adr14 In lvwadriana.ListItems
If adr14.SubItems(2) = "14:00" Then
    txtclient14.Text = adr14.SubItems(3)
    txtserv14.Text = adr14.SubItems(4)
    Exit For
End If

For Each adr143 In lvwadriana.ListItems
If adr143.SubItems(2) = "14:30" Then
    txtclient143.Text = adr143.SubItems(3)
    txtserv143.Text = adr143.SubItems(4)
    Exit For
End If

For Each adr15 In lvwadriana.ListItems
If adr15.SubItems(2) = "15:00" Then
    txtclient15.Text = adr15.SubItems(3)
    txtserv15.Text = adr15.SubItems(4)
    Exit For
End If

For Each adr153 In lvwadriana.ListItems
If adr153.SubItems(2) = "15:30" Then
    txtclient153.Text = adr153.SubItems(3)
    txtserv153.Text = adr153.SubItems(4)
    Exit For
End If

For Each adr16 In lvwadriana.ListItems
If adr16.SubItems(2) = "16:00" Then
    txtclient16.Text = adr16.SubItems(3)
    txtserv16.Text = adr16.SubItems(4)
    Exit For
End If

For Each adr163 In lvwadriana.ListItems
If adr163.SubItems(2) = "16:30" Then
    txtclient163.Text = adr163.SubItems(3)
    txtserv163.Text = adr163.SubItems(4)
    Exit For
End If

For Each adr17 In lvwadriana.ListItems
If adr17.SubItems(2) = "17:00" Then
    txtclient17.Text = adr17.SubItems(3)
    txtserv17.Text = adr17.SubItems(4)
    Exit For
End If

For Each adr173 In lvwadriana.ListItems
If adr173.SubItems(2) = "17:30" Then
    txtclient173.Text = adr173.SubItems(3)
    txtserv173.Text = adr173.SubItems(4)
    Exit For
End If

For Each adr18 In lvwadriana.ListItems
If adr18.SubItems(2) = "18:00" Then
    txtclient18.Text = adr18.SubItems(3)
    txtserv18.Text = adr18.SubItems(4)
    Exit For
End If

For Each adr183 In lvwadriana.ListItems
If adr183.SubItems(2) = "18:30" Then
    txtclient183.Text = adr183.SubItems(3)
    txtserv183.Text = adr183.SubItems(4)
    Exit For
End If

For Each adr19 In lvwadriana.ListItems
If adr19.SubItems(2) = "19:00" Then
    txtclient19.Text = adr19.SubItems(3)
    txtserv19.Text = adr19.SubItems(4)
    Exit For
End If

For Each adr193 In lvwadriana.ListItems
If adr193.SubItems(2) = "19:30" Then
    txtclient193.Text = adr193.SubItems(3)
    txtserv193.Text = adr193.SubItems(4)
    Exit For
End If



Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next

Tentar não é saber, é ter a certeza que vai descobrir

Dicas excel, vba, Access http://vbaedit.blogspot.com.br/

 
Postado : 26/08/2015 5:59 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Me parece a montagem de uma agenda; porem sem saber o objetivo/necessidade fica muito difícil propor alterações. Poste sua planilha, com alguns dados, substitua dados/valores confidenciais por fictícios, descrevendo o que espera que ocorra

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 27/08/2015 6:10 am