+ Reply to Thread
Results 1 to 9 of 9

Show form when activating a cell VBA

  1. #1
    Registered User
    Join Date
    08-08-2012
    Location
    Slagelse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    20

    Show form when activating a cell VBA

    Hi all,

    I am trying to make my worksheet show a userform when going to a certain cell. I don't know what to do. I have tried the following code, but it doesn't work for me.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If ActiveCell.Address = "$B$13" Then
    Kalender.Show
    End If
    End Sub

    Anyone have an idea?

    Thanks

    -Ronnie.

  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: Show form when activating a cell VBA

    Ronnie

    Change ActiveCell.Address to Target.Address.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-08-2012
    Location
    Slagelse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Show form when activating a cell VBA

    I have changed "activecell" to "target" but it still doesn't work.

    It seems like it does not go into the change-sub. I tried to expand the code to check for that:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$14" Then
    Kalender.Show
    Cells(15, 5).Value = 1
    End If
    Cells(15, 5).Value = 0
    End Sub

    But nothing happens.
    Last edited by RonnieODIN; 03-21-2013 at 01:59 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Show form when activating a cell VBA

    do you want the worksheet change, you will then need to change something in that cell before the code will run.
    try Private Sub Worksheet_SelectionChange(ByVal Target As Range)


  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Show form when activating a cell VBA

    Try it like this;

    Please Login or Register  to view this content.
    Hope that helps!

    Please use Code Tags when posting Code.
    Last edited by Winon; 03-21-2013 at 03:33 AM. Reason: Use Code Tags when posting Code
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Registered User
    Join Date
    08-08-2012
    Location
    Slagelse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Show form when activating a cell VBA

    I just changed to SelectionChange and tried a single cell - this works.

    The cell I would like to use is a merged cell. How do I work around that? The cells B13 to F13 are merged.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Show form when activating a cell VBA

    This should work in that case:

    Please Login or Register  to view this content.
    Last edited by Winon; 03-21-2013 at 03:58 AM.

  8. #8
    Registered User
    Join Date
    08-08-2012
    Location
    Slagelse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Show form when activating a cell VBA

    Thank you all very much for your answers.

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Show form when activating a cell VBA

    You are welcome,

    Did you manage to solve your issue?, if so, please remember to mark your Thread as "Solved".

    Thank you for the Rep.

+ Reply to Thread

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