您好,欢迎来到中国最大的生活服务网站![登录][注册]
版主:Mniwtian   副版主:
点击查看所有副版主

I''ll give you some

Following is an example of using the Range property on a Range object. (In this case, the Range object is the active cell.) This example treats the Range object as if it were the upper-left cell in the worksheet, and then it enters a value of 5 into the cell that would be B2. In other words, the reference returned is relative to the upper-left corner of the Range object. Therefore, the statement that follows enters a value of 5 into the cell directly to the right and one row below the active cell:

 

ActiveCell.Range("B2") = 5

 

I said this is confusing. Fortunately, there is a much clearer way to access a cell relative to a range: the Offset property. I discuss this property after the next section.

 

The Cells property

Another way to reference a range is to use the Cells property. You can use the Cells property, like the Range property, on Worksheet objects and Range objects. Check the Help system, and you see that the Cells property has three syntaxes:

 

object.Cells(rowIndex, columnIndex)

object.Cells(rowIndex)

object.Cells

 

examples that demonstrate how to use the Cells property. The first example enters the value 9 into cell A1 on Sheet1. In this case, I''m using the first syntax, which accepts the index number of the row (from 1 to 1048576) and the index number of the column (from 1 to 16384):

 

Worksheets("Sheet1").Cells(1, 1) = 9

 

Here''s an example that enters the value 7 into cell D3 (that is, row 3, column 4) in the active worksheet:

用户名: 请您登录后再发帖 
标 题: 标题请勿超过30个字
内 容:
 
  请阅读我们的[服务条款]
Copyright © 2009 Yahoo.com.cn 版权所有 不得转载 | 使用须知 | 著作权声明 | 京ICP证000022号 | 国家药监局(京)-经营性-2004-0039
全球阿里巴巴 - 阿里巴巴网络:中国站 国际站 日文站 | 淘宝站 | 支付宝 | 中国雅虎 | 口碑网 | 阿里软件 | 阿里妈妈