VBA代码,用整数查找列中的第一行,并将rownum存储为变量

时间:2017-06-07 10:54:20

标签: vba

我知道这很简单,但我是VBA的新手,我真的不知道自己在做什么

Dim StartRow As Range
Dim Sht As Worksheet
Dim TotalRows As Long
Dim StartCell As Integer    

Set StartRow = Sht.Range("J7").End(xlDown)  'I just need to create a variable for the first
' row with numerical figures in column J and then use this as a starting point for my
' data in column D as well.

最后,我希望VBA代码选择两个范围(一个在D列,一个在J中),但两者之间的起点相同,但在电子表格中它们会有所不同,因此End( XlDown)功能。范围只需要选择所有数据,直到它的#N A N A符号为止。

1 个答案:

答案 0 :(得分:0)

range("j7:j100").SpecialCells(xlCellTypeConstants,xlnumbers).Cells(1,1).row