Thread: Call Sub
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Call Sub

If you call from a different workbook, then you have to specify the Projectt
name (Workbook in Excel) and the module where the macro resides.


"Bishop" wrote in message
...
I'm trying to call a sub routine in another spreadsheet but I keep getting
a
compile error "sub or function not defined." I have the following code:

...
If Not mybook Is Nothing Then

'Need to do the following:
'if lazy eye hasn't been run in directorcopy then run
it
With mybook.Worksheets("DirectorCopy")
If .Cells(1, 1) = "" Then
Call DirectorFormat
DCLastRow = .Range("A" &
Rows.Count).End(xlUp).Row
'Determine how many rows in directorcopy
Else
DCLastRow = .Range("A" &
Rows.Count).End(xlUp).Row
End If
...

Call DirectorFormat is giving me the error. I've also tried Call
DirectorCopyFormat.DirectorFormat (DirectorCopyFormat is the module
Directorformat sits in) but that gives me the same error. What am I doing
wrong?