Results 1 to 2 of 2

running vba on active cell selection

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-23-2007
    Location
    Suffolk, UK
    Posts
    298

    running vba on active cell selection

    hello,

    i have a holiday planner that i'm working on, i have a cell range of B15:C155 the has the days start and finish B & C, i already have a calendar within the workbook but cannot seem to get it to activate when a cell within the range is selected, here is the vba for the calendar

    Sub OpenCalendar()
    ' Displays the UserForm and calendar
    ' Shortcuts should be made to this procedure
        frmCalendar.Show
    End Sub
    Option Explicit
    
    
    Private Sub Workbook_Open()
        Dim NewControl As CommandBarControl
    ' Assign shortcut to display calendar on SHIFT+CTRL+C
        Application.OnKey "+^{C}", "Module1.OpenCalendar"
    ' Add item to shortcut menu on open
        On Error Resume Next
        Application.CommandBars("Cell").Controls("Insert Date").Delete
        On Error GoTo 0
        Set NewControl = Application.CommandBars("Cell").Controls.Add
        With NewControl
            .Caption = "Insert Date"
            .OnAction = "Module1.OpenCalendar"
            .BeginGroup = True
        End With
    End Sub
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ' Delete item from shortcut menu on close
        On Error Resume Next
        Application.CommandBars("Cell").Controls("Insert Date").Delete
    End Sub
    can anyone help me??

    thanks reg
    Last edited by reggie1000; 08-15-2008 at 12:28 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1