type error 13

Katılım
6 Aralık 2007
Mesajlar
3
Excel Vers. ve Dili
excel 2007 türkçe
ben vba excelde bi program yazmaya calısıyorum. yazdıgım programda user dan ay sayısı alıyorum.. sayıyı yazdıgı testbox a - veya bucuklu sayı gırerse veya hiç birsey girmezse msg boxun cıkmasını ıstıyorum fakat program asagıdakı kodu yazdıgım zaman runtime error 12 type mismatch hatası verıyor. bunun nedenı ne olabılır yardımcı olursanız cok sevınırımm...



Private Sub CommandButton3_Click()
Dim i As Integer
Dim x As Integer
x = TextBox1.Text

Sheets("Sheet2").Range("H2") = TextBox1.Text
Sheets("Sheet2").Range("b1") = " DEMAND OF PRODUCT"
Sheets("Sheet2").Range("c1") = " UNIT OF PRODUCT"
Sheets("Sheet2").Range("g2") = " NUMBER OF MONTHS"

For i = 1 To x

Sheets("Sheet2").Cells(RowIndex:=i + 2, columnIndex:=1) = i
Next
With Worksheets("Sheet2")
.Visible = True
.Activate
End With


With TextBox1

If .Value = "" Or Not IsNumeric(.Value) Then
MsgBox "Enter a positive integer.", vbInformation, _
"Invalid entry"
.SetFocus
Exit Sub

End If

If .Value < 1 Then
MsgBox "Enter a positive integer.", vbInformation, _
"Invalid entry"
.SetFocus
Exit Sub
End If



' Capture the valid entry in the NMonthsNew variable.
nTextBox1New = TextBox1.Text
End With



Unload Me

End

End Sub
 
Üst