jessie_leung 发表于 2007-3-5 12:31

请教问题_《Excel VBA 基础入门》(已解决)

<p><table cellspacing="0" cellpadding="0" width="390" border="0" xstr="" style="WIDTH: 293pt; BORDER-COLLAPSE: collapse;"><colgroup><col width="390" style="WIDTH: 293pt; mso-width-source: userset; mso-width-alt: 12480;"></col><col></col></colgroup><tbody><tr height="19" style="HEIGHT: 14.25pt;"><td width="390" height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 293pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">P57 例3-7</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体"></font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">Sub 多重判断()</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">If Range("A1") &lt; 0 Then</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">Range("b1") = "小于零"</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">ElseIf Range("a1") = 0 Then</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">Range("b1")<font class="font6" color="#0000ff">.Value</font><font class="font0"> = "等于零"</font></font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">Else</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">Range("b1")<font class="font6" color="#0000ff">.Value</font><font class="font0"> = "大于零"</font></font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">End If</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体">End Sub</font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><font face="宋体"></font></td></tr><tr height="19" style="HEIGHT: 14.25pt;"><td height="19" style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 14.25pt; BACKGROUND-COLOR: transparent;"><p><font face="宋体">不输入".value" 时,结果也是一样,它有何作用?</font></p><p><font face="宋体">谢谢!</font></p></td></tr></tbody></table></p>
[此贴子已经被作者于2007-3-5 16:20:55编辑过]

清风徐徐 发表于 2007-3-5 13:15

<table id="topTable" width="100%"><tbody><tr id="headerTableRow2"><td align="left"><span id="nsrTitle"><b class="mainheaders">Range.Value 属性</b></span></td></tr></tbody></table><p>返回或设置一个 <b>Variant</b> 型,它代表指定单元格的值。</p><p>你要是想表示单元格的值时 可以省略".value"。</p>

兰色幻想 发表于 2007-3-5 13:24

<p>value在表示单个单元格的值时是可以省略的,如</p><p>range("a1")=range("b1")</p><p>等同于</p><p>range("a1").value=range("b1").value</p><p>但表示多个单元格值时value就不能省略了,如</p><p>range("a1:a10")=range("b1:b10") <font color="#1d1dc0">错</font></p><p>range("a1:a10")=range("b1:b10").<font color="#be3030">value </font><font color="#1919a2">正确</font></p>

jessie_leung 发表于 2007-3-5 13:49

再请教一下:<br/>range("a1:a10")<font style="BACKGROUND-COLOR: #ffff00;">.value</font>=range("b1:b10").<font color="#be3030">value<br/><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这里需要加上吗?&nbsp; </font><br/></font><font color="#000000">谢谢!</font>

兰色幻想 发表于 2007-3-5 14:25

<div class="msgheader">QUOTE:</div><div class="msgborder"><b>以下是引用<i>jessie_leung</i>在2007-3-5 13:49:28的发言:</b><br/>再请教一下:<br/>range("a1:a10")<font style="BACKGROUND-COLOR: #ffff00;">.value</font>=range("b1:b10").<font color="#be3030">value<br/><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这里需要加上吗?&nbsp; </font><br/></font><font color="#000000">谢谢!</font></div><p>这里不需要,你试试就知道了,</p>
页: [1]
查看完整版本: 请教问题_《Excel VBA 基础入门》(已解决)