+ Reply to Thread
Results 1 to 4 of 4

WorkSheet SelectionChange on a worksheet that doesnt yet exist

  1. #1
    Registered User
    Join Date
    08-19-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2013
    Posts
    3

    WorkSheet SelectionChange on a worksheet that doesnt yet exist

    Hi,

    I was wondering is it possible to create a worksheet selection change on a worksheet that will be created later on in my vba code?

    I am trying to code this: http://img.chandoo.org/c/on-demand-c...-the-chart.png , but i want my macro to do some other stuff before the worksheet, where Private sub should be placed exists.

    Sorry for my poor english.
    Yours sincerely,

    Johan

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: WorkSheet SelectionChange on a worksheet that doesnt yet exist

    Perhaps you could use the SheetSelectionChange workbook event?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: WorkSheet SelectionChange on a worksheet that doesnt yet exist

    Your options are:

    -use the workbook sheetselectionchange event and test for the name of the new worksheet before running the code within it
    -use vba to create the code in the new worksheet object module when it is created

    I would heavily recommend the first one because:
    -it is much easier
    -some security settings will block access to the vbproject reference of the vba object module that you need to create code within the workbook

  4. #4
    Registered User
    Join Date
    08-19-2014
    Location
    Stockholm, Sweden
    MS-Off Ver
    2013
    Posts
    3

    Re: WorkSheet SelectionChange on a worksheet that doesnt yet exist

    Thanks guys for the help.
    That sorted it out quite easily!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. SelectionChange worksheet with too many macros
    By Scott N in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-11-2013, 10:10 PM
  2. [SOLVED] using macro to check worksheet if data input in another worksheet exist.
    By Curtis goh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-30-2013, 01:02 AM
  3. Replies: 4
    Last Post: 06-18-2006, 01:10 PM
  4. Worksheet SelectionChange Event
    By mjack003 in forum Excel General
    Replies: 2
    Last Post: 05-08-2006, 03:35 PM
  5. Worksheet SelectionChange event
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-23-2005, 08:05 PM

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