0
我得到一個類型不匹配錯誤的下面的,如果iRowValue空檢查類型不匹配,運行時間錯誤13
我所試圖做的是確定值的表已經存在,那麼更新列或在最後追加。
Public iRowValue As Long
Public iRow As Long
----------
Private Sub Update_Click()
Dim Rng As Range
Dim FindString1 as String
With ws.Range("A:A")
Set Rng = .Find(What:=FindString1, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Rng Is Nothing Then
MsgBox "Name does not Exists"
Else
iRowValue = Rng.Row
End If
End With
**If iRowValue <> "" Then**
iRow = iRowValue
Else
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
End If
ws.Cells(iRow, 1).Value = Me.FirstName.Value
ws.Cells(iRow, 2).Value = Me.LastCode.Value
End Sub
謝謝丹尼爾。它的工作現在很好。 –