#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Calculations

Hi shone try this, the only way i no:

Rightclick on sheet-SUPPLIED-tap
select Show Programcode
paste this kode in window to the right:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C2:C20")) Is Nothing Then Exit Sub
If Target = "" Then Exit Sub

Dim r, Code, Checknr

Checknr = ""
Code = Target.Offset(0, -1)

If Code = "" Then Target = "": Target.Offset(0, -1).Select: Exit Sub

For r = 2 To 20
If Sheets("STOCK").Cells(r, 1) = Code Then
Checknr = "ok"
Sheets("STOCK").Cells(r, 2) = Sheets("STOCK").Cells(r, 2) + Target.Value
End If
Next

If Checknr = "" Then
Target.Select
MsgBox ("No match in Database"): Target = ""
Sheets("DATABASE").Select
End If

End Sub


and put this in sheet SOLD kode-window

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C2:C20")) Is Nothing Then Exit Sub
If Target = "" Then Exit Sub

Dim r, Code, Checknr

Checknr = ""
Code = Target.Offset(0, -1)

If Code = "" Then Target = "": Target.Offset(0, -1).Select: Exit Sub

For r = 2 To 20
If Sheets("STOCK").Cells(r, 1) = Code Then
Checknr = "ok"
Sheets("STOCK").Cells(r, 2) = Sheets("STOCK").Cells(r, 2) - Target.Value
End If
Next

If Checknr = "" Then
Target.Select
MsgBox ("No match in Database"): Target = ""
Sheets("DATABASE").Select
End If

End Sub

The kode check for quantity and if CD-Code nr is in DATABASE

best regards. PM
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 695
Default Calculations

Now im avake i realised there is another way :-)

Paste this formula in Sheet-STOCK B2 and copy down
=SUMPRODUCT((SUPPLIED!B2:B20=STOCK!A2)*(SUPPLIED!C 2:C20))-SUMPRODUCT((SOLD!B2:B20=STOCK!A2)*(SOLD!C2:C20))


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Calculations


@EXCELENT

ThankYou ;)
Works perfect!

(I like 2nd solution more, pretty straight forward).


--
shone
------------------------------------------------------------------------
shone's Profile: http://www.excelforum.com/member.php...o&userid=35126
View this thread: http://www.excelforum.com/showthread...hreadid=573300

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
order of calculations in Excel Kickseek Excel Worksheet Functions 3 August 18th 06 02:26 PM
complex calculations juliadesi Excel Discussion (Misc queries) 6 March 17th 06 01:14 PM
Calculations based on PivotTable information jerry Excel Discussion (Misc queries) 0 October 3rd 05 07:25 PM
Calculations crossing multiple sheets Stephen McArthu Excel Discussion (Misc queries) 4 June 6th 05 04:35 PM
time interval calculations in excel Krishna Excel Discussion (Misc queries) 6 April 8th 05 02:57 PM


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"