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
#12320
Bom dia!

Gostaria de acrescentar na rotina abaixo que quando insira uma informação na planilha excel ( banco de dados) ele formate com as linhas de bordas : na planilha, Exibição, vou tirar linhas de grade barra de formulas, titulos, tudo, vou deixar branca e quando for inserindo os dados ele vá se formatando e criando as linhas de bordas...

o comando que uso para inserir dados a planilha:


Plan1.Select
Range("A2").Select

Dim iRow As Long
Dim WS As Worksheet
Set WS = Worksheets("Cadastro_de_Clientes")
Range("B2").Select

While ActiveCell <> ""
If cmb_pesquisa.Text = ActiveCell Then
If MsgBox("Cliente já Existe, deseja susbtituir?", vbYesNo) = vbYes Then
GoTo continue
Else
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'C_AGENDA_DE_MEDIDAS.txtFcodcliente = ""
C_AGENDA_DE_MEDIDAS.cx_nome_cliente = ""
C_AGENDA_DE_MEDIDAS.cx_tel_celular = ""
C_AGENDA_DE_MEDIDAS.cx_tel_fixo = ""
C_AGENDA_DE_MEDIDAS.cx_tel_trabalho = ""
C_AGENDA_DE_MEDIDAS.cx_email = ""
C_AGENDA_DE_MEDIDAS.cx_endereço = ""
C_AGENDA_DE_MEDIDAS.cx_numero = ""
C_AGENDA_DE_MEDIDAS.cx_ap = ""
C_AGENDA_DE_MEDIDAS.cx_Bloco = ""
C_AGENDA_DE_MEDIDAS.cx_predio = ""
C_AGENDA_DE_MEDIDAS.cx_Bairro = ""
C_AGENDA_DE_MEDIDAS.cx_cidade = ""
C_AGENDA_DE_MEDIDAS.cx_aproximidade = ""


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

If cx_nome_cliente.Value = "" Then
MsgBox " Selecione Algum Nome Para Poder Cadastrar!"
Exit Sub
End If
iRow = ActiveCell.Row

WS.Cells(iRow, 1).Value = Me.txtFcodcliente.Value
WS.Cells(iRow, 2).Value = Me.cx_nome_cliente.Value
WS.Cells(iRow, 3).Value = Me.cx_tel_celular.Value
WS.Cells(iRow, 4).Value = Me.cx_tel_fixo.Value
WS.Cells(iRow, 5).Value = Me.cx_tel_trabalho.Value
WS.Cells(iRow, 6).Value = Me.cx_email.Value
WS.Cells(iRow, 7).Value = Me.cx_endereço.Value
WS.Cells(iRow, 8).Value = Me.cx_numero.Value
WS.Cells(iRow, 9).Value = Me.cx_ap.Value
WS.Cells(iRow, 10).Value = Me.cx_Bloco.Value
WS.Cells(iRow, 11).Value = Me.cx_predio.Value
WS.Cells(iRow, 12).Value = Me.cx_Bairro.Value
WS.Cells(iRow, 13).Value = Me.cx_cidade.Value
WS.Cells(iRow, 14).Value = Me.cx_aproximidade.Value


continue:


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'C_AGENDA_DE_MEDIDAS.txtFcodcliente = ""
C_AGENDA_DE_MEDIDAS.cx_nome_cliente = ""
C_AGENDA_DE_MEDIDAS.cx_tel_celular = ""
C_AGENDA_DE_MEDIDAS.cx_tel_fixo = ""
C_AGENDA_DE_MEDIDAS.cx_tel_trabalho = ""
C_AGENDA_DE_MEDIDAS.cx_email = ""
C_AGENDA_DE_MEDIDAS.cx_endereço = ""
C_AGENDA_DE_MEDIDAS.cx_numero = ""
C_AGENDA_DE_MEDIDAS.cx_ap = ""
C_AGENDA_DE_MEDIDAS.cx_Bloco = ""
C_AGENDA_DE_MEDIDAS.cx_predio = ""
C_AGENDA_DE_MEDIDAS.cx_Bairro = ""
C_AGENDA_DE_MEDIDAS.cx_cidade = ""
C_AGENDA_DE_MEDIDAS.cx_aproximidade = ""


C_AGENDA_DE_MEDIDAS.cmb_pesquisa.SetFocus

MsgBox "Cliente Salvo com Sucesso!!!", , ""
#12348
Boa tarde!!

Associe a rotina abaixo.
Código: Selecionar todos
Sub Bordas_I()
    Dim rng As Range

    Set rng = Range("A1:F20") 'Intervalo que eu quero usar

    With rng.Borders
        .LineStyle = xlContinuous
        .Color = vbRed 'Cor vermelha
        .Weight = xlThin
    End With
End Sub
Ou
Código: Selecionar todos
Sub Bordas_II()
For Each cell In Range("A1", Range("A65536").End(xlUp))
     
    With Range(cell, cell.Offset(0, 4)) 'Adiciona em 4 colunas, favor ajustar
         
        With .Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
         '    With .Borders(xlInsideHorizontal)
         '        .LineStyle = xlContinuous
         '        .Weight = xlThin
         '        .ColorIndex = xlAutomatic
         '    End With
    End With
Next

End Sub
Att
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