English 中文(简体)
Excel 2011 VBA - 海关职能,使最后一行达到[复制]。
原标题:Excel 2011 VBA - custom function to get the last row in a range [duplicate]
  • 时间:2011-11-24 12:30:35
  •  标签:
  • excel
  • vba

我一直在尝试各种方式,以找到最后一段路段,并将这一数字退回到一条路边,没有结果。

这里,我有这部法律。

Sub StartHere()
    Dim oSheet As Worksheet
    Set oSheet = WorkSheets(1)
    ProcessData(oSheet)
End Sub

Sub ProcessData(ByVal wkst As Worksheet)
    Dim rng As Range
    Dim lastRow As Long

     set range
    Set rng = wkst.Range("L:S")  Range that i want to process data on

     get the last row (in Long datatype)
    lastRow = CLng(getLastRowInRange(rng))

End Sub

Function getLastRowInRange(ByRef rng As Range)
    getLastRowInRange = rng.Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows,_ SearchDirection:=xlPrevious).Row
End Function

我正在把米斯马特语打成型号。

getLastRowInRange = rng.Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByRows,_ SearchDirection:=xlPrevious).Row

Any clues, guys?

最佳回答
ProcessData(oSheet)

删除括号

否则,你就通过<代码>的违约财产的价值。 Sheet Object, which it doesn t have. 你们应当获得“目标不支持这种财产或方法”。

在这样做之后,改变职能要求:

getLastRowInRange = rng.Cells.Find(What:="*", After:=rng.Cells(1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

<代码>After必须属于搜索范围。 页: 1

最后,确保你在<代码>Find 回归代码>上处理案件。 (目前你没有打上<代码>。) http://www.un.org。

问题回答

暂无回答




相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签