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 ctcarlosteles
#38135
Boa tarde,

Quero gerar um código para atribuir uma Macro existente à um objeto.
Ao gravar Macro para tentar encontrar o código correspondente, dá no seguinte resultado:

Sub Macro2()
ActiveSheet.Shapes.Range(Array("Rounded Rectangle 16")).Select
Selection.OnAction = "Planilha1.Sortear"
End Sub


Entretanto, ao tentar rodar esta Macro, a mesma não funciona.
Alguém sabe o código correto?
Por osvaldomp
#38144
Qual o nome da macro? Planilha1.Sortear ou Sortear ?

Em que módulo está essa macro ?
Por ctcarlosteles
#38149
Boa tarde,
Poderia ajudar no arquivo em anexo?
O objetivo é atribuir a "Macro3" na forma "Rounded Rectangle 15" através do botão "Atribuir Macro" (Macro 2). Os códigos estão no Módulo 2.
Você não está autorizado a ver ou baixar esse anexo.
Por osvaldomp
#38153
Os Retângulos estão agrupados. Se for viável desfazer o agrupamento utilize o primeiro código abaixo, se não, utilize o segundo.
Código: Selecionar todos
Sub Macro2()
 ActiveSheet.Shapes("Retângulo: Cantos Arredondados 15").OnAction = "Macro3"
End Sub
Código: Selecionar todos
Sub Macro2()
 ActiveSheet.Shapes("Grupo 2").Ungroup
 ActiveSheet.Shapes("Retângulo: Cantos Arredondados 15").OnAction = "Macro3"
 ActiveSheet.Shapes.Range("Retângulo: Cantos Arredondados 15").Regroup.Name = "Grupo 2"
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