+ Reply to Thread
Results 1 to 2 of 2

Dropdown menu with selected value problem!

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question Dropdown menu with selected value problem!

    Ive found a code that im using in a project but im having trouble with it. It works fine but I want my dropdown menu to interact something else when i choose "delete".
    Im making a exercise program in Excel for a friend of mine and ive used the following code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$C$2" Then
    If Range("I2") = "" Then
    Range("I2") = Target.Value
    Range("J2") = Format(Now, "dd.mm.yy kl.hh:mm")
    Else
    Range("I" & Rows.Count).End(xlUp).Offset(1) = Target.Value
    Range("J" & Rows.Count).End(xlUp).Offset(1) = Format(Now, "dd.mm.yy kl.hh:mm")
    End If
    End If
    If Target.Address = "$C$3" Then
    If Range("L2") = "" Then
    Range("L2") = Target.Value
    Range("M2") = TimeSerial(Hour(Time), Minute(Time), 0)
    Else
    Range("L" & Rows.Count).End(xlUp).Offset(1) = Target.Value
    Range("M" & Rows.Count).End(xlUp).Offset(1) = TimeSerial(Hour(Time), Minute(Time), 0)
    End If
    End If
    If Target.Address = "$C$4" Then
    If Range("O2") = "" Then
    Range("O2") = Target.Value
    Range("P2") = TimeSerial(Hour(Time), Minute(Time), 0)
    Else
    Range("O" & Rows.Count).End(xlUp).Offset(1) = Target.Value
    Range("P" & Rows.Count).End(xlUp).Offset(1) = TimeSerial(Hour(Time), Minute(Time), 0)
    End If
    End If
    End Sub

    The dropdown menu ive used is made by datavalidation. Each time I chose an item from my dropdown menu I get the option shown in for example the column "I2". And when I choose the next item it wil show this selected value on the next row. At the same time date and time appears beside the option ive chosen. My problem is:

    When i select "delete" from my dropdown menu the previous row should become blank(both the dat/time and the option i made earlier). Ive searched the web after a similar problem but i havent found a solution yet. Im hoping some genious in this forum might help me with this problem.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Dropdown menu with selected value problem!

    Hello mezzer,

    Welcome to the forum - glad to have you here.

    Perhaps, when reading the forum rules ( you did read them, right?), you may have overlook this one:
    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button).
    As soon as you correct your post to add the missing code tags someone will help with a solution.
    Thanks.

    By the way, if you haven't read the forum rules, please do so by clicking the link at the very top of this page.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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