Run Time Error 9

smilelover

New Member
Joined
Jul 24, 2011
Messages
32
Code:
For i = 1 To 100
    For j = 1 To 8
    [B]Sheets("5. SUPPLIER Freight INC").Cells(2 * i, j + 3) = Sheets("3. SUPPLIER DUTIES Repriced").Cells(2 * i, j + 3) + Sheets("4. Freight Per Unit").Cells(8 * i + j - 5, 43)[/B]
    Next j
Next i

The Code in bold are said to have error
Subscript out of range.

Any idea why?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Any idea why?

First thought is that though not case senitive, there is one (or more) tab(s) not named the same in the workbook as they are in the code.
 
Upvote 0
Now it went to a different error call RunTime 13 error: Mismatch
I think thats because my code are all strings, and we can't suppose to do maths with strings, anything that I can do?
 
Upvote 0
What range of cells are you trying link to the "5. SUPPLIER Freight INC" tab from which range from the other two tabs?
 
Upvote 0
Well I found out where my main problem is
My 4.FreightPerUnit Sheet has #VALUE after cells(200,43)
is there an IF function that can tell my code that if its #VALUE, then make my target Cell =0
If not, continue my original function
 
Upvote 0
Cells(8 * i + j - 5, 43)
is it range AQ4?
Check this one maybe causing the error about the subscript...
 
Upvote 0
try to add
On error GoTo Err1 in your code whereas Err1: target cell=0 resume next
 
Upvote 0
I found out where my main problem is

That's what's causing the Run-time error '13:' error message but not your original Run-time error '9:' error message.

If you can tell me the ranges you're dealing with I dare say I may be able to provide some kind of solution (though it's getting late here in Oz).
 
Upvote 0
I am in Aus as well,
but I am fine already,
got it with my mate
The problem is I didn't add a .Value on some places
need to define where the #ERROR happens
and yes villy its in AQ4
 
Upvote 0

Forum statistics

Threads
1,224,604
Messages
6,179,857
Members
452,948
Latest member
UsmanAli786

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