Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 20th, 2004, 06:20 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reduce the stock when place order

Hello All

My problem is :
This code works fine, but when i place the ordered Qyt in the invoice sheet (E19.....E49),
the qyt should be reduced from the quantities range (D32:D1800) in the stock sheet..........

Ths problem, the reduction is placed one row below the row that contain the qyts ordered

i donot know why i tested the code line by line............but

pls, any help would be appreciated....

the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OrdVal As Long
Dim strOrd As String
Dim lrow As Long
Dim rngStock As Range
Dim myCheck As Integer

On Error GoTo err
If Application.Intersect(Target, Range("C19:C49")) Is Nothing Then
    'Exit Sub
Else
    OrdVal = Target.Value
    strOrd = Target.Offset(0, 2).Value

myCheck = MsgBox("" & OrdVal & " Units of " & strOrd & " were ordered", vbYesNo)
    If myCheck = vbNo Then
    Exit Sub
    End If

    lrow = Application.Match(strOrd, Sheet3.Range("C1:C1800"), 0)
    Set rngStock = Sheet3.Range("C1").Offset(lrow, 1)
    rngStock.Value = rngStock.Value - OrdVal
End If
Set rngStock = Nothing
err: Exit Sub
End Sub



yours
hesham

Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stock feed hudeanee Excel VBA 1 July 24th, 2007 08:29 PM
stock management- closing stock and opening stock bright_mulenga Access 1 July 16th, 2007 07:11 AM
reduce viewstate size vantoko BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 May 10th, 2007 07:20 AM
How to reduce the processing time for this prob? changeable Excel VBA 0 October 27th, 2004 04:12 AM
Stock Quote JonnyRPI Classic ASP Basics 1 June 3rd, 2003 09:43 PM



All times are GMT -4. The time now is 01:24 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.