View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default 'LastRow' Function not working

Range("B0") is not a valid cell reference.
It will have to be a named range if it's going to work.


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Randy Reese" wrote in message
et...

This is basically what I have. It was working at one time. Not sure why

now.


__________________________________________________ __

Private Sub btnProcess_Click()
btnProcess.Enabled = False

Call test1

End Sub
__________________________________________________ __
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
after:=sh.Range("B0"), _
lookat:=xlPart, _
LookIn:=xlValues, _
searchorder:=xlByRows, _
searchdirection:=xlPrevious, _
MatchCase:=False).Row

On Error GoTo 0
End Function
__________________________________________________ _

Public Sub ProcessSingle1(ws As Worksheet, WS2 As Worksheet, Str As

String)

Dim LRow As Long
LRow = LastRow(WS2)
End Sub
__________________________________________________ _

Sub test1()
ActiveCell.Activate
Dim ws As Worksheet
Dim WS2 As Worksheet
Dim Str As String



'UNSCHEDULED
Set ws = Sheets("Unsc.")
Set WS2 = Sheets("Print281")
Str = "81"
Call ProcessSingle(ws, WS2, Str)

End Sub
__________________________________________________ _