Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default How to avoid: Error of run Time '13'

Hello,

I use follwing listing to insert two dates ina workbook:

Sub InserimentoPeriodo()
Dim DataInizio As Date
Dim DataFine As Date

If ActiveSheet.Name < "Rates1" Then
Worksheets("Rates1").Activate
End If

DataInizio = InputBox("Inserisci la data di INIZIO periodo nel formato
gg-mmm-aaaa", "Confronto Variazioni Prezzi", "1-mag-1997")

If Year(DataInizio) < 1997 Then
MsgBox "Usare solo date dell'anno 1997", vbOKOnly
Exit Sub
End If
Range("E1").Value = DataInizio

DataFine = InputBox("Inserisci la data di FINE periodo nel formato
gg-mmm-aaaa", "Confronto Variazioni Prezzi", "10-set-1997")
If Year(DataFine) < 1997 Then
MsgBox "Usare solo date dell'anno 1997", vbOKOnly
Exit Sub
End If
Range("E2").Value = DataFine

End Sub

If I answer to the imputbox question with "Cancel" I get the message:
Error of run Time '13'
How may avoid it?

Thank you for helping

--
dilettante
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How to avoid: Error of run Time '13'

One solution would be to use "On Error GoTo Next" (without the qotemarks)
just before your IF statement. Another would be to include another IF
statement that says
If Data Inizio = "" Then
(do something)
End If"

"dilettante" wrote:

Hello,

I use follwing listing to insert two dates ina workbook:

Sub InserimentoPeriodo()
Dim DataInizio As Date
Dim DataFine As Date

If ActiveSheet.Name < "Rates1" Then
Worksheets("Rates1").Activate
End If

DataInizio = InputBox("Inserisci la data di INIZIO periodo nel formato
gg-mmm-aaaa", "Confronto Variazioni Prezzi", "1-mag-1997")

If Year(DataInizio) < 1997 Then
MsgBox "Usare solo date dell'anno 1997", vbOKOnly
Exit Sub
End If
Range("E1").Value = DataInizio

DataFine = InputBox("Inserisci la data di FINE periodo nel formato
gg-mmm-aaaa", "Confronto Variazioni Prezzi", "10-set-1997")
If Year(DataFine) < 1997 Then
MsgBox "Usare solo date dell'anno 1997", vbOKOnly
Exit Sub
End If
Range("E2").Value = DataFine

End Sub

If I answer to the imputbox question with "Cancel" I get the message:
Error of run Time '13'
How may avoid it?

Thank you for helping

--
dilettante

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
how to avoid zero error in log log plot rgandhi1 Charts and Charting in Excel 1 February 14th 07 09:07 PM
How to avoid error? AD108 Excel Programming 1 August 7th 06 06:52 AM
UDF/VBA Function, trap error, avoid #VALUE! [email protected] Excel Programming 6 March 22nd 06 03:39 PM
How to avoid an error dialog justaguyfromky Excel Programming 2 February 18th 06 10:02 PM
Avoid error with simple subtraction function wjsubs[_6_] Excel Programming 1 July 9th 04 07:27 PM


All times are GMT +1. The time now is 02:15 AM.

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

About Us

"It's about Microsoft Excel"