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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • 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.