slamet Harto
05-26-2008, 04:18 AM
Hi there,
I've an userform with the following code, however, If we chose "CboBps" for the first time userform show than it will reflect debug with message "Run time error 13" Type mismacth
Q2: What is format function that I can use with this userform if I want to change the format data in entire column E, for example, the data as format like this:
Column E >>> It should be
12.000 >>> 12000
20.000 >>> 20000
Could you help me to fix the error, please?
Any reply or suggestion, would be highly appreciate it.
Many thanks in advance,
Rgds,Harto
Private Sub TxtCurrPts_Change()
If Not TxtCurrPts = "" Then
TxtCurrPts = FormatNumber(TxtCurrPts, 0)
TxtTotpts = FormatNumber(CSng(TxtCurrPts), 0) ' + TxtCurrPts, 0)
TxtTotpts.ForeColor = IIf(TxtTotpts < 0, vbRed, vbBlue)
TxtCurrPts = FormatNumber(TxtCurrPts, 0)
End If
End Sub
Private Sub Cbobps_Change()
If Not Cbobps = "" Then
Cbobps = FormatNumber(Cbobps, 0)
TxtTotpts = FormatNumber(CSng(Cbobps) + TxtCurrPts, 0)
TxtTotpts.ForeColor = IIf(TxtTotpts < 0, vbRed, vbBlue)
End If
End Sub
Private Sub userform_initialize()
With Cbobps
.AddItem 10000
.AddItem 20000
.AddItem 30000
.AddItem 40000
.AddItem 50000
.AddItem 60000
.AddItem 70000
.AddItem 80000
.AddItem 90000
End With
End Sub
I've an userform with the following code, however, If we chose "CboBps" for the first time userform show than it will reflect debug with message "Run time error 13" Type mismacth
Q2: What is format function that I can use with this userform if I want to change the format data in entire column E, for example, the data as format like this:
Column E >>> It should be
12.000 >>> 12000
20.000 >>> 20000
Could you help me to fix the error, please?
Any reply or suggestion, would be highly appreciate it.
Many thanks in advance,
Rgds,Harto
Private Sub TxtCurrPts_Change()
If Not TxtCurrPts = "" Then
TxtCurrPts = FormatNumber(TxtCurrPts, 0)
TxtTotpts = FormatNumber(CSng(TxtCurrPts), 0) ' + TxtCurrPts, 0)
TxtTotpts.ForeColor = IIf(TxtTotpts < 0, vbRed, vbBlue)
TxtCurrPts = FormatNumber(TxtCurrPts, 0)
End If
End Sub
Private Sub Cbobps_Change()
If Not Cbobps = "" Then
Cbobps = FormatNumber(Cbobps, 0)
TxtTotpts = FormatNumber(CSng(Cbobps) + TxtCurrPts, 0)
TxtTotpts.ForeColor = IIf(TxtTotpts < 0, vbRed, vbBlue)
End If
End Sub
Private Sub userform_initialize()
With Cbobps
.AddItem 10000
.AddItem 20000
.AddItem 30000
.AddItem 40000
.AddItem 50000
.AddItem 60000
.AddItem 70000
.AddItem 80000
.AddItem 90000
End With
End Sub