Thread: Runtime Error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert Martin Robert Martin is offline
external usenet poster
 
Posts: 1
Default Runtime Error

I currently use Office XP on Vista Ultimate
I'm a novice at programing.

I have been given a workseeht by my new employer.
When I try to add a comment in one area I get this error
Runtime Error 438
Object Doesn't Support Property or Method. When I enter debug
it's stopped at the "ListRowCount = Selection.ListObject.ListRows.Count"


Here is the sub routine.
Public Sub CheckJobName(JobName As String)
Dim ListRowCount As Integer
Dim msgResponse As Variant

Sheets("Time Sheet").Select
Range("C137").Select
ListRowCount = Selection.ListObject.ListRows.Count
If FoundName(JobName, Range("C136:C" & ListRowCount)) = True Then
msgResponse = MsgBox("There appears to be a job named " & JobName &
" already. Do you still wish to add it?", vbExclamation + vbYesNo, "Item
Exists?")
If msgResponse = vbNo Then
Range("A1").Select
frmAdd.lblStatus.Caption = "Job not added."
Exit Sub
Else
AddJob JobName
End If
Else
AddJob JobName
End If

End Sub