--- sc/source/core/tool/interpr5.cxx	2005-04-14 09:50:06.000000000 +0530
+++ sc/source/core/tool/interpr5.cxx	2005-04-25 17:00:39.866199840 +0530
@@ -1440,8 +1440,13 @@ ScMatrixRef ScInterpreter::MatDiv(ScMatr
 			for (j = 0; j < nMinR; j++)
 			{
 				if (pMat1->IsValueOrEmpty(i,j) && pMat2->IsValueOrEmpty(i,j))
-					pResMat->PutDouble(pMat1->GetDouble(i,j) /
-									   pMat2->GetDouble(i,j), i, j);
+				{
+					double fDen = pMat2->GetDouble(i,j);
+					if( fDen == 0 )
+						pResMat->PutError( errDivisionByZero, i, j );
+					else
+						pResMat->PutDouble(pMat1->GetDouble(i,j) / fDen, i, j);
+				}
 				else
 					pResMat->PutString(ScGlobal::GetRscString(
 													STR_NO_VALUE), i, j);
@@ -1997,6 +2002,11 @@ void ScInterpreter::ScDiv()
 		{
 			fVal = fVal2;
 			bFlag = FALSE;			// Matrix - double
+			if( fVal == 0 )
+			{
+				SetError( errDivisionByZero );
+				return ;
+			}
 		}
         SCSIZE nC, nR;
 		pMat->GetDimensions(nC, nR);
@@ -2007,7 +2017,13 @@ void ScInterpreter::ScDiv()
 			if (bFlag)
 			{	for ( SCSIZE i = 0; i < nCount; i++ )
 					if (pMat->IsValue(i))
-						pResMat->PutDouble(fVal / pMat->GetDouble(i), i);
+					{
+						double fDen = pMat->GetDouble(i);
+						if( fDen == 0 )
+							pResMat->PutError( errDivisionByZero, i );
+						else
+							pResMat->PutDouble(fVal / fDen, i);
+					}
 					else
 						pResMat->PutString(ScGlobal::GetRscString(STR_NO_VALUE), i);
 			}
@@ -2024,7 +2040,12 @@ void ScInterpreter::ScDiv()
 			PushError();
 	}
 	else
-		PushDouble(fVal1 / fVal2);
+	{
+		if( fVal2 == 0 )
+			SetError( errDivisionByZero );
+		else
+			PushDouble( fVal1 / fVal2 );
+	}
 	if ( nFmtCurrencyType == NUMBERFORMAT_CURRENCY && nFmtCurrencyType2 != NUMBERFORMAT_CURRENCY )
 	{	// auch DM/DM ist nicht DM bzw. DEM/EUR nicht DEM
 		nFuncFmtType = nFmtCurrencyType;
