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 MegaT
#47623
Olá Turma,
Gostaria de uma ajuda referente ao vinculo de macro, ela precisa ser executada na mesma linha, onde é colocado qualquer valor de forma manual, porem, essa macro é executada na linha inferior a da mesma coluna.
Print em anexo.
Código!

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect

Set KeyCells = Range("F1:F9999")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then

ActiveSheet.Unprotect

linha = ActiveCell.Row
Range("G" & linha).Select
ActiveCell.Value = Now()
Selection.Locked = True

End If
End Sub

Agradeço desde já!
Por babdallas
#47626
Provavelmente está configurado para quando você der enter, o cursor move para a célula inferior.

Neste caso, use:
Código: Selecionar todos
linha = ActiveCell.Row-1
ao invés de
Código: Selecionar todos
linha = ActiveCell.Row
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