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.
  • Avatar do usuário
Avatar do usuário
Por Angra
Posts Avatar
#43470
Bom dia
Tenho uma duvida, se existe a possibilidade de inserir/trocar alguns valores dentro da macro no vba, a partir da inserção de valores em células na plan :D :D
Você não está autorizado a ver ou baixar esse anexo.
Por babdallas
#43583
Tente assim:
Código: Selecionar todos
Sub Atribuir()

Dim i           As Long
Dim LinIndex    As Long
Dim LinStart    As Long
Dim LinEnd      As Long
Dim NomeBola    As String
Dim NumeroBola  As Long

    With wshBolas
        LinStart = .Range("V31").Value2 'trocar o valor
        LinEnd = .Range("U31").Value2    'trocar o valor
        LinIndex = .Cells(.Range("T31").Value2, 2).Value 'trocar o valor
        NomeBola = Application.Caller
        NumeroBola = VBA.Right(NomeBola, 2)

        For i = 20 To 22
            If .Cells(LinIndex + LinStart - 1, i).Value = Empty Then
                .Cells(LinIndex + LinStart - 1, i).Value = NumeroBola
                Exit For
            End If
        
            If .Cells(LinIndex + LinStart - 1, i).Value = NumeroBola Then
                VBA.MsgBox "Bola repetida"
                Exit For
            End If
        
            If i = 22 Then
                VBA.MsgBox "Limite excedido"
                Exit For
            End If
        Next i
    End With
End Sub
Por babdallas
#43584
Segue em anexo a pasta de trabalho.
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