Jump to content
fgarcia90

check um range

Recommended Posts

fgarcia90

Boas, sou novato em VBA e estou a tentar iniciar um programa no excel.

Na sheet2 tenho na coluna A uns utilizadores de windows e na coluna B outros

Coloquei o código num modulo e consigo obter o utilizador do windows mas não consigo obter os valores dos utilizadores e compara-los com o utilizador de windows para depois consoante atribuir como pessoal duma secção ou de outra.

Sub seccao()

Dim user As Variant

user = Environ("USERNAME")

Dim seccao_type As String

If user = Sheet2.Range("A1:A20").Value Then

seccao_type = "Tecnica"

ElseIf user = Sheet2.Range("B1:B20").Value Then

seccao_type = "Comercial"

End If

MsgBox seccao_type

End Sub

Obrigado

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.