Getting an Overflow and Type Mismatch Error for No Reason

L

Legacy 389185

Guest

I have a listbox like this ;
IDyukleme_limaniyukleme_ulkesibosaltma_limanibosaltma_ulkesiarac_tipilokal_masrafnavlunnavlun2doviznakliye_firmasi
1GEBZETURKIYEATINAYUNANISTANA5010050EURTHYSEN
2ATINAYUNANISTANGEBZETURKIYEC2020050EURTHYSEN
3GEBZETURKIYEROMAITALYAD5030020EURCEEVA
4AMBARLITURKIYEROMAITALYAB4020060USDCEEVA
5GEBZETURKIYEROMAITALYAF30400100USDEKOL
6ATINAYUNANISTANROMAITALYAA6030050USDEKOL
7LEFKOSAKIBRISATINAYUNANISTANA40
200EURCEEVA
8CESMETURKIYELEFKOSAKIBRISB2010050USDTHYSEN
9GEBZETURKIYELEFKOSAKIBRISD1050060USDEKOL
10ATINAYUNANISTANLEFKOSAKIBRISC40300100EUREKOL
11ROMAITALYAGEBZETURKIYEE50200200EURCEEVA
12ROMAITALYAAMBARLITURKIYEF60500500USDCEEVA
13GEBZETURKIYEATINAYUNANISTANE7010020USDTHYSEN
14AMBARLITURKIYEATINAYUNANISTANA4020030EUREKOL
15ATINAYUNANISTANROMAITALYAD8050050USDCEEVA
16LEFKOSAYUNANISTANROMAITALYAA2020060USDEKOL

<caption> list_navlun_kayit </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>


I have a code which helps me to get average of "navlun" results according to different "yukleme limanı" data. For example when I type "Gebze" in the filtering "yukleme limanı" text box, the list turns into a 5 row list and it gets the average of that 5 results in a textbox called "navlun2015ort" and this is my code;

----------------------------------------------------------------------
Private Sub yukleme_limani_ara_Change()


Dim aranan As String


aranan = Forms!navlun_kayit!yukleme_limani_ara.Text
Forms!navlun_kayit!yukleme_limani_ara_gecici = aranan
list_navlun_kayit.Requery


Dim TpNav As Double, aa As Long,


For aa = 1 To (Me.list_navlun_kayit.ListCount - 1)

TpNav = TpNav + Nz(CDbl(Me.list_navlun_kayit.Column(7, aa)), 0)


Next aa
Me.navlun2015ort = Int(TpNav / (aa - 1))




End Sub
----------------------------------------------------------------------

So there are 2 problems;
1)When I type something else thats not on the list under "yukleme limanı" column, program gives me a overflow error and highlighting this "Me.navlun2015ort = Int(TpNav / (aa - 1))" in the code.How can I correct that?

2)For example in the list, you can see that the 7th row of "navlun" column is empty. I used the code;
" Nz(CDbl(Me.list_navlun_kayit.Column(7, aa)), 0) " to get a zero value instead of empty cells but I guess it doesnt work because it gives me a "type mismatch" error. So how can I avoid it?

Thanks for you help guys.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How doesn't it work?


With Davg function I have to select a domain like a table but in this example I have to get average from the listbox with the visible rows which are selected by the filter.
 
Upvote 0
How are you populating the listbox?
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,938
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top