Pennafortt Posted July 5, 2012 at 06:49 PM Report Share #467534 Posted July 5, 2012 at 06:49 PM Boas . O código funciona bem, queria apenas mudar a maneira (cor) como é mostrado os binários na tabela A3:G10. Na versão original, zeros (0) e uns (1) tem fonte normal, cor cinza. Alterando no código (.Bold = False) para (.Bold = True) os binários (0-1) ficam em negrito cinza, então queria fazer e não deu muito certo, é manter o binário 1 (.Bold = False) original e o binário 0 em (.Bold = True) mas com a cor black, resumindo, 1 cinza normal e 0 black negrito. Sub Diagonal() Dim Intervalo As Range Dim Coluna1 As Range Dim Celula As Range Dim i As Integer Dim QtdeAzul As Integer Dim QtEnc As Integer Application.ScreenUpdating = False QtdeAzul = [A1].Value Set Intervalo = [A3:G10] With Intervalo.Font .ColorIndex = 15 .Bold = False End With For Each Celula In Coluna1 Celula.Select QtEnc = 0 While ActiveCell.Value = 1 And Not Application.Intersect(ActiveCell, Intervalo) Is Nothing QtEnc = QtEnc + 1 ActiveCell.Offset(-1, 1).Select Wend If QtEnc = QtdeAzul Then For i = 1 To QtdeAzul ActiveCell.Offset(1, -1).Select ActiveCell.Font.Color = vbBlue ActiveCell.Font.Bold = True Next End If Next Application.ScreenUpdating = True End Sub Cumps Link to comment Share on other sites More sharing options...
acao Posted July 8, 2012 at 02:04 PM Report Share #467896 Posted July 8, 2012 at 02:04 PM (edited) boas comenta o teu codigo ou diz aonde tens o valor 0 e 1 se não tens nenhuma variavel com este valor deverás implementar ou não querendo em vba e em excel 2010 vais a aba «base,formatação condicional, gerir regras. e colocas as regras. cumps acao Edited July 8, 2012 at 02:41 PM by acao Link to comment Share on other sites More sharing options...
Pennafortt Posted July 8, 2012 at 04:37 PM Author Report Share #467922 Posted July 8, 2012 at 04:37 PM Boas O codigo completo e o que ele faz em: http://www.filefactory.com/file/2thhvzvmfy7v/n/Diagonal_rar [/ url] cump Link to comment Share on other sites More sharing options...
acao Posted July 9, 2012 at 02:02 PM Report Share #468038 Posted July 9, 2012 at 02:02 PM (edited) boas substitua o cod seguinte em cada modulo e declare uma variavel range para a variavel Celula2. With Intervalo.Font .ColorIndex = 15 .Bold = False End With por isto: For Each Celula2 In Intervalo.Cells If Celula2.Value = 0 Then Celula2.Font.Color = vbBlack Celula2.Font.Bold = True Celula2.Interior.Color = xlNone Else Celula2.Font.ColorIndex = 15 Celula2.Font.Bold = False Celula2.Interior.Color = xlNone End If Next não sei se reparou mas o programa não corre o range todo (grelha) e interrompe a diagonal quando encontra um zero. Edited July 9, 2012 at 03:15 PM by acao Link to comment Share on other sites More sharing options...
Pennafortt Posted July 9, 2012 at 02:50 PM Author Report Share #468045 Posted July 9, 2012 at 02:50 PM Boas Meu nobre acao, o codigo foi desenvolvido com essa finalidade, interromper a diagonal e parar quando encontra um zero, vou implementar as alterações e volto a postar com o resultado obtido. cumps Link to comment Share on other sites More sharing options...
Pennafortt Posted July 9, 2012 at 03:00 PM Author Report Share #468048 Posted July 9, 2012 at 03:00 PM Boas Obrigado!! Com a tua ajuda consegui resolver o problema. Link to comment Share on other sites More sharing options...
acao Posted July 9, 2012 at 03:26 PM Report Share #468053 Posted July 9, 2012 at 03:26 PM boas se está resolvido dá o tópico resolvido. editei o meu ultimo tópico, «Celula2.select» não é necessário, foi para testar e depois esqueci-me de deletar. cumps acao Link to comment Share on other sites More sharing options...
Pennafortt Posted July 9, 2012 at 08:31 PM Author Report Share #468103 Posted July 9, 2012 at 08:31 PM Boas Não sei como colocar o topico como resolvido? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now