help useing DoubleClick

IvanK

New Member
Joined
Nov 16, 2018
Messages
26
I have written a program that uses Excel VBA to allow clients to sign in and out at the day care where I take my wife. I initially set up the program to ask the client to type in his client number, but now I want to have the client DoubleClick on his name in a list to get his sheet number. I cannot get the double click to work.
The Work Book opens at Sheet1 which is named Clients and has the client’s name in col A and the client’s sheet number in col B. I want the client to double click his name and have the code activate his sign in/out sheet. I can not get the double click to work. Can someone help me.
Attached is the code from the beginning of the program.
VBA Code:
Option Compare Text

Const BLANK = ""

'Private Sub Workbook_Open()
'Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",True)"
'Call GetClientNum
'End Sub
'Sub GetClientNum()

'End Sub
'MsgBox "get client name"
Private Sub Worksheet_BeforeDoubleClick(ByVal target As Range, Cancel As Boolean)
    Dim wks As Worksheet
 
    If target.Column = 1 And _
       target.Row >= 2 And _
       target.Value <> "" Then

        '  The check above is used to ensure we are looking at a client cell.

        Set wks = Worksheets(target.Offset(, 1).Value) 'this addresses the client sheet name

        '  Set CANCEL to TRUE so Excel will not try to handle the double-click event.
        Cancel = True

        'Set wks = Worksheets(target.Offset(, 1).Value)
        wks.Activate
Call xit
End Sub
 
Hi Dante, I can not call the sub “ClientNumGood” (which is in the ThisWorkbook code) from the BeforeDoubleClick code. Also when the client has ben logged in I can not get back to the double click code. I make the client list the active sheet but double clicking in the client sheet does not work. How do I move between the two code sheets?
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi Ivan.
If you have another macro, please create another thread to review the new requirement.
 
Upvote 0

Forum statistics

Threads
1,215,875
Messages
6,127,477
Members
449,385
Latest member
KMGLarson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top