![]() |
VBA / IF - Then / Custom Toolbar
Hello,
I'd like to have custom tool bar appear for "approved" users only. can see different approaches, but cannot find the light at the end o the tunnel. worksheet 'support' Range 'A40:A50' [named 'users'] lists approved user log-ins. Cell A51 = '=username()' <see code at the end Cell A52 = '=COUNTIF(Users,A51) If VBA code can confirm that the current user log-in is in rang 'users' and then display the custom toolbar 'special', or dont d anything would be preferred and i can delete cells A51/A52. Maybe VBA can check if A52<1 and not show the toolbar (or if A52= show the toolbar)? I'd assume that it would be something like IF(Cell/Range)="1", or I Cell/Range contains Username then display toolbar ELSE nothing End Sub I canot figure the right coding. Thank you for your assistance. Stefan --------------- With some assistance some time again i have this code to get th username. --------------- Option Explicit Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _ (ByVal lpBuffer As String, ByRef nSize As Long) As Long --------------- Function UserName() As String Dim stBuff As String * 255, lResult As Long, lBufflen As Long lBufflen = 255 lResult = GetUserName(stBuff, lBufflen) If lBufflen 0 Then UserName = Left(stBuff, lBufflen - 1) End Function -------------- -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 05:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com