+ Reply to Thread
Results 1 to 9 of 9

Stock Control

Hybrid View

  1. #1
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Stock Control

    Hello.
    I am having troubles (due to lack of programming skills) with following situation.

    My question is how to subtract the uniform from the "uniform table" when it is issued from the "new cadet" sheet or "issue extra uniform"?
    Also, what would be the best way to add data into "Loan" sheet from the "New Cadet" sheet?

    Regards, Vlad
    Attached Files Attached Files

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Stock Control

    The attached workbook is blank, could you please try attaching again?
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Stock Control

    For a second I thought I was blind and I didn't want to admit it.

  4. #4
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Stock Control

    Soz, something went wrong yesterday
    Attached Files Attached Files

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Stock Control

    Hi

    I am not sure if i understand corect your requietment..., but give a try to this, in G13.

    =INDEX('New Cadet'!G12:G21,MATCH('Issue Uniform'!D13,'New Cadet'!D12:D21,0))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Stock Control

    Sorry, it doesn't work in my spreadsheet. What it suppose to do?
    I thought that it going to be a macro to solve that kind of problem.

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Stock Control

    Formula works, OK, but really,i don't know if this is what are you looking for.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-03-2011
    Location
    Holt
    MS-Off Ver
    Excel 2010
    Posts
    27

    Re: Stock Control

    I am looking for a macro which will subtract qty of uniform from Uniform table, when that uniform is issued from the New Cadet worksheet (and Issue Equipment Sheet)

  9. #9
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Stock Control

    Have a look at the attached and see if that is what you are looking for, code bellow

    Sub New_Cadet()
    Application.ScreenUpdating = False
    Dim Item As String
    Dim Qty As Integer
    Dim r As Integer
    
    r = 12
    ActiveWorkbook.Sheets("New Cadet").Select
    
        Do Until Range("D" & r).Value = ""
            Item = Range("D" & r).Value
            Qty = Range("E" & r).Value
            
            ActiveWorkbook.Sheets("uniform").Select
            For i = 3 To Range("A10000").End(xlUp).Row
                If Range("B" & i).Value = Item Then
                    Range("C" & i).Value = Range("C" & i).Value - Qty
                    Exit For
                End If
            Next
            
            ActiveWorkbook.Sheets("New Cadet").Select
            r = r + 1
        Loop
    Application.ScreenUpdating = True
    End Sub
    
    Sub Extra_Item()
    Application.ScreenUpdating = False
    Dim Item, cdtNumber, cdtName As String
    Dim Qty As Integer
    Dim issueDate, returnDate As Date
    
    ActiveWorkbook.Sheets("Issue Uniform").Select
    
    cdtNumber = Range("B13").Value
    cdtName = Range("C13").Value
    Item = Range("D13").Value
    Qty = Range("E13").Value
    issueDate = Range("F13").Value
    returnDate = Range("G13").Value
    
    ActiveWorkbook.Sheets("uniform").Select
    For i = 3 To Range("A10000").End(xlUp).Row
        If Range("B" & i).Value = Item Then
            Range("C" & i).Value = Range("C" & i).Value - Qty
            Exit For
        End If
    Next
    ActiveWorkbook.Sheets("Loan").Select
    
    r = Range("A10000").End(xlUp).Row + 1
    
    Range("A" & r).Value = cdtNumber
    Range("B" & r).Value = cdtName
    Range("C" & r).Value = Item
    Range("D" & r).Value = Qty
    Range("E" & r).Value = issueDate
    Range("F" & r).Value = returnDate
    
    ActiveWorkbook.Sheets("Issue Uniform").Select
    
    Application.ScreenUpdating = True
    End Sub
    
    Sub Clear_Contents()
        Range("B11:B15").ClearContents
        Range("D12:E22").ClearContents
    End Sub
    Attached Files Attached Files

+ 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