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
#73567
Boa tarde galera,
Tenho esse código que serve para Gravar e Editar os dados na Planilha.

Essa parte do código pinta somente a primeira célula da linha, preciso ajustar para pintar o intervalo de 22 colunas na mesma linha.
ws.Cells(iRow, 1).Interior.Color = &H8080FF

Alguém pode me ajudar? Agradeço.


'Função Inserir ou Alterar
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("RELATORIO")

Worksheets("RELATORIO").Select
Range("A2").Select
While ActiveCell <> ""
If CbbId.Text = ActiveCell Then
'Se o nome já existir, faz a pergunta abaixo. Se não, passa direto.
If MsgBox("Cadatro localizado. Deseja fazer alteração?", vbQuestion + vbYesNo, "Pergunta") = vbYes Then
GoTo continue 'Função para Inserir e/ou Alterar
Else 'Se na Pergunta clicar em NÃO, limpa e encerra.

Exit Sub
End If
End If
ActiveCell.Offset(1, 0).Activate
Wend

continue:
iRow = ActiveCell.Row
'Inserir e/ou Alterar
On Error Resume Next
ws.Cells(iRow, 1).Value = Me.CbbId.Value
ws.Cells(iRow, 1).Interior.Color = &H8080FF
Editado pela última vez por miltonleandro em 28 Ago 2023 às 07:29, em um total de 1 vez.
Por osvaldomp
#73569
Olá, Milton.

Experimente:

ws.Cells(iRow, 1).Resize(, 22).Interior.Color = &H8080FF
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