Picture button VBA

tigerdel

Board Regular
Joined
Oct 13, 2015
Messages
53
I am looking to find out how to add code to my VBA script for when a picture button is clicked

I have a series of picture buttons which, if I click any one of them runs through a script to confirm or deny access

What I now need to do is:

If the access is granted to the picture button clicked, it take them to the required page

There are 8 picture buttons: i.e. Emma_Summary, Alex_Summary etc and they would click their button to access their page

The code that checks their access works to the Success Message and it is there that I need to add that whichever picture button was clicked it opens that page

Rich (BB code):
Sub shape_click()
Dim selName As String
Dim foundUser As Range
Dim userRow As Long
Dim userCol As Long
selName = Mid(Application.Caller, 1, InStr(1, Application.Caller, "_") - 1)
userRow = Sheets("Admin").Range("B5").Value
Set foundUser = Sheets("Admin").Range("D1:V1").Find(selName)
If foundUser Is Nothing Then
    MsgBox "User not found!"
    Exit Sub
End If
    userCol = foundUser.Column


If selName = Sheets("Admin").Range("B2") Or Sheets("Admin").Cells(userRow, userCol).Value = "Ð" Then
    MsgBox "Success!" -THIS IS WHERE I NEED THE CODE
Else
    MsgBox "You do not have access to this page!!"
End If
End If
End Sub
Thanks for looking
 
Last edited:

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,762
Office Version
2013
Platform
Windows
Is SelName the name of the sheet you want to go to? We call them sheets not Pages.
selName = Mid(Application.Caller, 1, InStr(1, Application.Caller, "_") -



 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,102,887
Messages
5,489,539
Members
407,697
Latest member
Lotte_4

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top