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.
#51704
ola... bom dia a todos!!!
encontrei na net esse codigo abaixo aí, e gostei dele... é enxuto e tem o que preciso, o necessario pro meu arquivo e inclui e adpatei o procedimento na minha planilha; o codigo faz bem o filtro, mas nao retorna/reexibe corretamente as abas associadas para o usuario, ou seja, nao exibe exatamente as abas definidas no filtro... sempre exibe uma que nao esta associado ao usuario e deixa de exibir uma que esta relacionada!
alguem tem alguma informacao sobre esse codigo que possa ajudar ou ja tenha feito algum ajuste pra melhorar a precisao na exibiçao das abas?
vlw pessoal.. forte abraço
muito obrigado.
Código: Selecionar todos
Private Sub CommandButton1_Click()
  Dim lTotal As Long
  Dim lContador As Long
  lsDesabilitar
    Sheets("Senha").Range("$A$1:$C$50000").AutoFilter Field:=1, Criteria1:="=" & txtUsuario.Text
    Sheets("Senha").Range("$A$1:$C$50000").AutoFilter Field:=2, Criteria1:="=" & txtSenha.Text
  lTotal = WorksheetFunction.Subtotal(3, Sheets("Senha").Range("A:A"))
https://www.aprenderexcel.com.br/2014/vba/como-fazer-uma-tela-de-login-para-acesso-ao-documento?utm_source=lec
  If lTotal > 1 Then
  ActiveWorkbook.Unprotect Password:="123"
    For lContador = 2 To lTotal
    Sheets(Sheets("Senha").Range("C" & lContador).Value).Visible = True
  Next lContador
  Unload frmLogin
    Else
    MsgBox "Usuário ou senha incorretos!"
  End If
  ActiveWorkbook.Protect Password:="123", Structure:=True, Windows:=False
  End Sub
  Private Sub txtUsuario_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
  KeyAscii = Asc(UCase(Chr(KeyAscii)))
  End Sub
  Private Sub UserForm_Activate()
  txtUsuario.SetFocus
  End Sub
  Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 13 Then 
  SendKeys "{tab}" 
  KeyAscii = 0 
  End If
End Sub
Código: Selecionar todos
Public Sub lsShow()
  frmLogin.Show
  End Sub
  Public Sub lsDesabilitar()
  ActiveWorkbook.Unprotect Password:="123"
    Sheets("Contas").Visible = False
    Sheets("Compras").Visible = False
    Sheets("Gastos").Visible = False
    Sheets("Senha").Visible = False
  ActiveWorkbook.Protect Password:="123", Structure:=True, Windows:=False
End Sub
Código: Selecionar todos
Private Sub Workbook_Open()
  lsDesabilitar
End Sub
Fonte: https://www.aprenderexcel.com.br/2014/v ... source=lec
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