Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all ; I'd like to build something useful IMO, any help would be
appreciated. As ever, for the record, I don't do proper VBA (Dim, Set, whatever). It's an invoice thingy. For starters, there's 2 sheets - "Input" (the invoice form, in A2:Fx) and Sheet2 for the table of products & prices (A2:Bx). I'd like a Worksheet_Change for Input!C:C ("Item"), If Target.Column = 3 Then etc. When an item is entered, the code should check whether the item already exists in Sheet2!A:A on the table sheet. If it does, it should pull in the price from Sheet2!B:B to Target.Offset(0,1). If it doesn't, it should run an input box ("How much is this item?") which then adds the item & price to Sheet2!A:B. I can kludge it to a point, but I'm fed up with doing that. Anyways, I know I'll get stuck eventually since I can never get Range("Sheet2!A_whatever").Value = Target.Value to work (i.e. writing from the event sheet to another). Posting what I have is pointless in the sense that none of you would ever use anything so ugly, on the other hand it might give one or two a much-needed chuckle at the near-end of a long week. I promise I'll try & understand any replies. TIA, Andy If Target.Column = 3 Then 'Trap DEL If Target = "" Then Exit Sub Range("Input!H1").Value = Target.Value 'I1 formula = "=IF(ISNA(MATCH(H1,Items,0)),0,1)" If Range("I1") = 0 Then MsgBox "New." 'Inputbox proc Else Application.EnableEvents = False Target.Range("B1").FormulaR1C1 = "=VLOOKUP(RC[-1],Prices,2,False)" Target.Range("B1").Value = Target.Range("B1").Value Application.EnableEvents = True End If End If |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I build a custom list in Excel | Excel Discussion (Misc queries) | |||
help to build a list of holidays for 6 years | Excel Worksheet Functions | |||
Trying to build list based on cell value | Excel Discussion (Misc queries) | |||
How do I conditionally build worksheet from existing worksheet? | Excel Discussion (Misc queries) | |||
how do I build a drop-down list in Excel? | Excel Worksheet Functions |