-
strange problem
Ok, can anyone help me with this prob? I dont understand how this can happen. Oh yeah, I am using VBA for excel 2000
Here we go:
I have a function
Code:
Private Sub SaveDeletedId(ByVal rowIndex As Long)
Dim i As Long
i = 2
With ThisWorkbook.Sheets("list")
Do While .Cells(i, "M").Value <> ""
i = i + 1
Loop
'Save the deleted member id
.Cells(i, "M").Value = ThisWorkbook.Sheets("data_jemaat").Cells(rowIndex, "B").Value
'sort the unused member id
.range("M1").Sort key1:=.Columns("M"), header:=xlYes
End With
End Sub
I got runtime error, so i used the debugger to look for the error. I found out that, after sorting the columns ("M"), even BEFORE it reached "end with", the function somehow called another function from another worksheet. The function is:
Code:
Private Sub cmbSearch_Click()
If cmbSearch.Value = "Date of Birth" Then
lblDobNotice.Visible = True
Else
lblDobNotice.Visible = False
End If
End Sub
If I remove the cmbSearch_click function, the prog runs fine. If I tried to remove the sort command, the same prob actually occured when my prog called for this
Code:
'Delete the selected record in the search result
ThisWorkbook.Sheets("list").range("K" & index & ":L" & index).Delete shift:=xlShiftUp
can someone enlighten me?
Thank you very much,
Regards,