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.
Por spider
#66853
oI,
Tenho abaixo o comando para inserir uma linha em branco após clicar na célula,
preciso que crie mais de uma linha, podem ajudar?

Obrigado.


======================================================
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim linha As Long

If ActiveCell.Column = 1 Then
linha = ActiveCell.Row

While Plan1.Range("A" & linha).Value <> ""

If Plan1.Range("A" & linha).Value <> "" Then
If Plan1.Range("A" & linha + 1).Value <> "" Then

If Plan1.Range("A" & linha).Value <> Plan1.Range("A" & linha + 1).Value Then

Plan1.Rows(linha + 1).Insert shift:=xlDown
Exit Sub

End If

End If

End If

linha = linha + 1

Wend
End If

End Sub
#66864
Olá, @spider .

Experimente:
Código: Selecionar todos
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 Dim k As Long, m As Long
  If Target.Count > 1 Then Exit Sub
  If Target.Column > 1 Then Exit Sub
  On Error Resume Next
  k = Range(Cells(Target.Row, 1), Cells(Rows.Count, 1).End(3)).ColumnDifferences(Target).Cells(1, 1).Row
  If k = 0 Or Cells(k, 1) = "" Then
   MsgBox "SELECIONE OUTRA CÉLULA": Exit Sub
  Else: m = Application.InputBox(prompt:="INSIRA A QUANTIDADE DE LINHAS", Type:=1)
   Rows(k).Resize(m).Insert
  End If
End Sub
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