Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Runtime Error

On Aug 14, 1:38 pm, "Robert Martin" wrote:
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


Try:

ListRowsCount = Worksheets("Time Sheet").ListObject("name of list
object").ListRows.Count

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
xpath error? Runtime Error 13 type mismatch SteveM Excel Discussion (Misc queries) 1 December 4th 07 09:16 AM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"