Quote:
Originally Posted by gbrew584
Is there a way I test just one section of my code? Sorry I'm getting a little off the topic.
|
That's fairly basic. Just use something like:
Code:
Sub Test()
Dim xlApp As Object, xlbook As Object, LastRow As Long
Const xlpart = 2
Const xlbyrows = 1
Const xlprevious = 2
Const xlformulas = 5
Set xlApp = CreateObject("Excel.Application")
Set xlbook = xlApp.workbooks.Add
xlbook.Sheets(1).Range("A1").PasteSpecial
With xlbook.Sheets(1)
If xlApp.WorksheetFunction.CountA(.Cells) <> 0 Then
LastRow = .Cells.Find(What:="*", _
After:=.Range("A1"), _
Lookat:=xlpart, _
LookIn:=xlformulas, _
SearchOrder:=xlbyrows, _
SearchDirection:=xlprevious, _
MatchCase:=False).Row
Else
LastRow = 1
End If
End With
MsgBox LastRow
End Sub