![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
ive got this macro:
Sub EnterAnotherSale() ' ' EnterAnotherSale Macro ' Enters another sale into the system ' Rows("5:5").Select Selection.Insert Shift:=xlDown Range("F5").Select ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]" Range("A5").Select 'Look for the ProductID in the Stock Table. StockWorkbook.Seek "=", ProductID 'When found, take the current quantity and subtract from it the sold quantity. If Not StockWorkbook.EOF Then StockWorkbook.Edit StockWorkbook!Quantity = StockWorkbook!Quantity - SalesWorkbook!Quantity StockWorkbook.Update ' End Sub But the bit 'Look for the ProductID in the Stock Table. StockWorkbook.Seek "=", ProductID 'When found, take the current quantity and subtract from it the sold quantity. If Not StockWorkbook.EOF Then StockWorkbook.Edit StockWorkbook!Quantity = StockWorkbook!Quantity - SalesWorkbook!Quantity StockWorkbook.Update needs to run AFTER all the sale data has been entered and enter has been pressed in CELL F5. Plz can you give me the intermidiate code!?!?!? |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
............!!
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
plzzzzzzzzzz
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
this and the thing above is stopping me from finishing plz!!!
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
SHOULD BE EASYYYYYY plz
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 33
|
it sounds like the code at the end should be placed in a different subroutine. One solution is to place a button on the spreadsheet that the user clicks when finished entering information. Place the code in the click event of that button. I know there is a way to put some code in the Worksheet_Change event that will detect if something has been done to a particular cell, e.g. F5, but not sure how to do it offhand.
[ This Message was edited by: tk19 on 2002-03-19 12:29 ] |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
hey thanks a lot but does anyone know how to do that when enter is pressed in cell 5 it runs that code shown above???!?!? plzzzzz
|
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,064
|
Hi Sam
Hey we know your doing an exam, but cool be patient people will answer you given time, we are all busy doing excelling things. look ive gone back to help. OK look.. F5 is the target and so what you need to find out is whats in cell F5 is it blank, what going to be entered text value, example please. so what you need to do is code out so: if F5 = or <> whatever then .... .... . .. Else ... ... your code, thats sort of idea will work easy enough. Sorry to be awkward but you must as ive said before understand your work, i have no education so i know the difference, understand mean results means PASS. Mighti suggest you check the VBA help files??? Let us know what you have found out and tried and well do what we can..
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
Cell F5 is just the total cost of the cell. Its got the formula D5*E5. Help plz!
|
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Mar 2002
Posts: 122
|
Cell F5 is just the total cost of the cell. Its got the formula D5*E5. Help plz!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|