Jump to content
Fórum Script Brasil
  • 0



Olá, Pessoal!

Por gentileza, gostaria da ajuda de vocês.Preciso aplicar esse código para dois shapes na mesma aba, porém ele não aceita mesmo inserindo as variáveis novas.
Realizei algumas tentativas, porém somente uma atualiza.

Option Explicit

Public Sub PreencherCorFormas5()
    Dim strNomeForma   As String
    Dim rngCelulas      As Range
    Dim lngCor As Long, lngRed As Long, lngGreen As Long, lngBlue As Long
    With wshPrincipal
        For Each rngCelulas In .ListObjects("tbTipo").ListColumns("Tipo Cor").DataBodyRange
            strNomeForma = CStr(rngCelulas.Offset(, -1).Value2)

            lngCor = .Range(rngCelulas.Value).Interior.Color
            lngRed = lngCor Mod 256
            lngGreen = (lngCor \ 256) Mod 256
            lngBlue = (lngCor \ 65536) Mod 256
            .Shapes.Range(strNomeForma).Fill.ForeColor.RGB = RGB(lngRed, lngGreen, lngBlue)
        Next rngCelulas
    End With
End Sub


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...