ERROR 13 - Type Mismatch
Posted by Montgomery on November 13, 2001 8:24 AM
What I want to achieve here is that when the message box asks if I want to continue and I say no. I want the worksheet to be saved and the application to quit. I have gotten it to work for my other workbooks but I don't what is happening with this one.
If response = vbyes then
Dim SelText As String
Dim i As Integer
Const PerilsCol = 19 'Perils in colum S
SelText = " ' "
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
SelText = Right(SelText & ListBox1.List(i) & " ", Len(SelText & ListBox1.List(i) & " ") - 1)
'put value in next available cell in perils column
Cells(65536, PerilsCol).End(xlUp).Offset(1).Value = SelText
I substituted the unload me bit with code to save the workbook and exit excel and I get the error message and it also show the screen asking if I want to save the document, which I don't get with the other workbooks, but when I save the workbook and go reopen it the column for the listbox is empty. I even went as far as putting - If vbno then (execute code) and it still does not work. Could someone take a look at the above code and see if they could tell me what is wrong