Please some1 tell me this one 2 - last one i need V URGENT!

Sami

Board Regular
Joined
Mar 4, 2002
Messages
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!?!?!?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0
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
 
Upvote 0
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..
 
Upvote 0
Cell F5 is just the total cost of the cell. Its got the formula D5*E5. Help plz!
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,198
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top