+ Reply to Thread
Results 1 to 10 of 10

Dependant? Data Validation

Hybrid View

  1. #1
    Registered User
    Join Date
    12-07-2007
    Posts
    6
    That's great. Thank you for your help so far.

    I have managed to do that, but realise that the example I gave in my original question was too vague.

    How do I get this to apply to all of the cells in columns C, F, I, L, O, R, U, X & AA from row 7 down (for an infinate number of rows), so that the user is forced to enter the choice in the cell to the right of the one they are populating and the calculation then appearing in the cell to the right of the choice?
    Last edited by matrixskydiver; 12-08-2007 at 11:03 AM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Good Morning!
    This modification should act on the ranges you requested.
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim userInput As String
    
    If Target.Address Like "?[CFLIORU]*" Or Target.Address Like "$AA*" And _
         Target.Row >= 7 And Target.Cells.Count = 1 Then
        If IsNumeric(Target.Value) Then
        Do
           userInput = Application.InputBox("Low, Mid, High, or Firm", Default:="Mid", Type:=2)
           If userInput = "False" Then
                Rem Cancel pressed
               Application.EnableEvents = False
               Application.Undo
               Application.EnableEvents = True
               Exit Sub
           End If
        Loop Until userInput Like "[LMHFlmhf]*"
        Application.EnableEvents = False
        With Target
            .Range("b1").Value = Application.Proper(userInput)
        
            Select Case UCase(Left(userInput, 1))
                Case "L"
                    .Range("c1") = Val(.Value) * 0.25
                Case "M"
                    .Range("c1") = Val(.Value) * 0.5
                Case "H"
                    .Range("c1") = Val(.Value) * 0.75
                Case "F"
                    .Range("c1") = Val(.Value)
            End Select
        End With
        Application.EnableEvents = True
        End If
    End If
    End Sub

  3. #3
    Registered User
    Join Date
    12-07-2007
    Posts
    6
    You are brilliant!!!!! It works!!!! I am totally grateful for all of your help. I will get serious gold stars at work on Monday.

    Thank you.
    XXXXX

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    mikerickson

    I like your use of Like to match column address.
    I would never have though of that method.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ 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