Notifications
Clear all

Grifar linha através de um listbox

3 Posts
2 Usuários
0 Reactions
593 Visualizações
(@jnexcel)
Posts: 0
New Member
Topic starter
 

Boa tarde!

Por favor, seria possível grifar uma linha através de um listbox?

em anexo, seguem uma imagem de exemplo.

muito obrigado.

 
Postado : 19/02/2018 9:08 am
(@klarc28)
Posts: 0
New Member
 
Private Sub CommandButton1_Click()
Dim linha As Long
If Me.ListBox1.ListIndex >= 0 Then
linha = Me.ListBox1.ListIndex + 2
Plan1.Range("A" & linha & ":C" & linha).Interior.Color = vbRed
Plan1.Range("A" & linha & ":C" & linha).Font.Color = vbWhite

End If
End Sub

Para limpar formatação:

Private Sub CommandButton2_Click()
Plan1.Range("A2:C" & Plan1.UsedRange.Rows.Count).ClearFormats
End Sub
 
Postado : 19/02/2018 9:18 am
(@jnexcel)
Posts: 0
New Member
Topic starter
 

Muito obrigado!

 
Postado : 20/02/2018 4:56 am