public static PtgArea getRange( Ptg p ) throws IllegalArgumentException
	{
		if( p instanceof PtgArea )
		{
			return (PtgArea) p;
		}
		if( p instanceof PtgName )
		{    // get source range
			Ptg[] pr = null;
			try
			{
				pr = ((PtgName) p).getName().getCellRangePtgs();
				return (PtgArea) pr[0];
			}
			catch( Exception e )
			{
				try
				{    // if it's a PtgRef, convert to a PtgArea
					if( !(pr[0] instanceof PtgArea) && (pr[0] instanceof PtgRef) )
					{
						PtgArea pa = new PtgArea();
						pa.setParentRec( pr[0].getParentRec() );
						pa.setLocation( pr[0].getLocation() );
						return pa;
					}
					throw new IllegalArgumentException( "Expected a reference-type operand" );
				}
				catch( Exception ex )
				{
					throw new IllegalArgumentException( "Expected a reference-type operand" );
				}
			}
		}
		return null;
	}