Consulting

Results 1 to 2 of 2

Thread: i want to validate users entered value with existing range in another sheet

  1. #1
    VBAX Newbie
    Joined
    Jan 2017
    Posts
    1
    Location

    i want to validate users entered value with existing range in another sheet

    I want to create a program in which "current stock" sheet has range of data, located in column C and user will add new data, in "consumption sheet" column D, which may or may not be the same as entered in "current stock". So i want to check if user's entered value is same as the value one of cell of range of my "current stock" sheet.
    Their is one another question. The question is their any way in application. inputbox such that i can use value before "." and use that value to store in another cell?
     Sub consumption()
    Dim counter As Integer
    Dim i As Integer
    Dim x As Integer
    Dim ws As Worksheet
    Dim wc As Worksheet
    Dim rangs As Range, rangc As Range
    Dim plate As Integer
    Set ws = ThisWorkbook.Worksheets("current stock")
    Set wc = ThisWorkbook.Worksheets("consumption")
    Cells(i, 3).Value = Application.InputBox(prompt:="Entre a Dwg No.", Type:=2)
    plate = Application.InputBox(prompt:="Entre a plate code:", Type:=2)
    Set rangs = ws.Range("c4:c128")
    With rangs.Validation
    .Delete
    .Add xlValidateList, xlvalidalerstop, xlBetween, rangs, plate
    End With

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    use value before "."
    Two ways:
    Use the first item in a Split array

    Use Instr to find the location of the "." then use Left to return the value up to the "."
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

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