![]() |
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 |
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 |
All times are GMT +1. The time now is 05:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com