+ Reply to Thread
Results 1 to 6 of 6

need to make this userform not accept any number more than stock number

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    need to make this userform not accept any number more than stock number

    Hello all expert
    i create this excel sheet that have two button for make the following action
    1- Click here to add Stock Quantity
    which will open form that allow enter data from manufacture to stockdatabase sheet
    2-Click here to add Withdraw Quantity that allow enter data withdrawed or sold to withdrawdatabase sheet

    the problem now i need when i open withdraw form nd enter value excess from corresponding data in stock , give me message that
    the number enter in quantity is more than stock

    for example in my example
    in sheet Withdrawdatabase in row 10
    have product Settling TSA batch 1111
    and this batch quantity produced in stock was 450 from Stockdatabase in row 2
    and in withdraw its sold for two locate before (row 2,3 ) (150, 300) and again in row 10 location 1 have 200
    i need to prevent this to accept number more than stock


    best regards
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: need to make this userform not accept any number more than stock number

    I think it would be in your xtBatchNo_Exit event.

    Something like....
    Private Sub TxtBatchNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
        Dim ws As Worksheet, sh As Worksheet
        Dim Rws As Long, Rng As Range, c As Range, lookRng As String
    
        Set ws = Worksheets("StockDatabase")
        Set sh = Worksheets("WithdrawDatabase")
    
        With ws
            Rws = .Cells(Rows.Count, "E").End(xlUp).Row
            Set Rng = .Range(.Cells(1, "E"), .Cells(Rws, "E"))
        End With
    
        lookRng = Me.TxtBatchNo
        Set c = Rng.Find(what:=lookRng, lookat:=xlWhole)
    
        If Not c Is Nothing Then
            MsgBox c.Offset(0, -1) - Me.txtQty.Value    'edit this to do what you need.
        Else: MsgBox "Not Found"
            Exit Sub
        End If
    
    
    End Sub

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: need to make this userform not accept any number more than stock number

    its not working well because its allow to add value
    please see my attached file in withdrawdatabase sheet
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: need to make this userform not accept any number more than stock number

    Do you can help me to not allow enter value more than available

  5. #5
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: need to make this userform not accept any number more than stock number

    and please i add new items in withdraw userform nameed ( available quantity)
    i think it will be good idea that will show every time want to withdraw any quantity
    how can make this not allow any value more than available

  6. #6
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Ljubljana
    MS-Off Ver
    Office 365
    Posts
    1,054

    Re: need to make this userform not accept any number more than stock number

    even by add helper column in any sheet

+ 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. can i make it so i can also type number into combobox in userform
    By justlearning123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2015, 10:02 PM
  2. Formula to copy a number from a cell and make the number fixed
    By Brycker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-29-2015, 01:59 PM
  3. Make an UDF accept range or string or number as input
    By Jacc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2013, 06:58 AM
  4. Each cell to accept number 1 to 5 only
    By oldtimer26 in forum Excel General
    Replies: 3
    Last Post: 12-06-2007, 06:22 PM
  5. format a cell to accept a date or a whole number
    By trick95 in forum Excel General
    Replies: 1
    Last Post: 03-04-2006, 10:00 AM
  6. How to set a column to accept only a specified number of digits
    By ashvik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2005, 08:05 AM
  7. How to set a column to accept only a specified number of digits
    By ashvik in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2005, 07:05 AM

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