Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#71890
Boa tarde!

Gostaria da ajuda de vocês. Estou trabalhando com uma macro (contribuição de uma colega do forum) que insere uma linha abaixo sempre que a resposta for PC ou NC

====
Private Sub Worksheet_Change(ByVal Target As Range)
'O que for digitado na coluna C será escrito em maiúsculo
On Error Resume Next
If Not Intersect(Target, Range("V:V")) Is Nothing Then
Application.EnableEvents = False
Target = UCase(Target)
Application.EnableEvents = True
End If
On Error GoTo 0

'Se na coluna V não estiver digitado NC ou PC não fazer nada
If Target.Column <> 22 Or Target.Text <> "NC" And Target.Text <> "PC" Then Exit Sub
Rows(Target.Row + 1).Insert
Cells(Target.Row + 1, 23).Resize(, 42).Merge
Cells(Target.Row + 1, 23).Select
Cells(Target.Row + 1, 22).ClearContents
End Sub
====

Preciso incorporar a essa macro a seguinte orientação: todas as vezes que em determinado bloco de perguntas aparecer respostas NC ou PC, uma nova linha deve ser inserida ao final do bloco, conforme descrito a seguir. Encaminha uma planilha anexa com a macro e maiores detalhes.

Como deve ser
--------------------
Bloco 1
---------------------
Pergunta 1 = C
Pergunta 2 = NC (Como a resposta foi NC, inserir uma linha abaixo da pergunta 2)
Pergunta 3 = C
Pergunta 4 = C
Pergunta 5 = PC (Como a resposta foi PC, inserir uma linha abaixo da pergunta 5)
(Como neste bloco apareceram respostas PC ou NC, inserir mais uma linha abaixo da pergunta 5)
---------------------
Bloco 2
---------------------
Pergunta 1 = C
Pergunta 2 = C
Pergunta 3 = NC (Como a resposta foi NC, inserir uma linha abaixo da pergunta 3)
(Como neste bloco apareceram respostas PC ou NC, inserir mais uma linha abaixo da pergunta 3)
---------------------
Bloco 3
---------------------
Pergunta 1 = C
Pergunta 2 = PC (Como a resposta foi PC, inserir uma linha abaixo da pergunta 2)
Pergunta 3 = C
Pergunta 4 = C
(Como neste bloco apareceram respostas PC ou NC, inserir uma linha abaixo da pergunta 4)
---------------------

Obrigado
Você não está autorizado a ver ou baixar esse anexo.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord