View Full Version : Run time error '6'

07-30-2010, 02:58 AM
dim lastrow as long

lastrow = Sheets("GroundFixed").Range("A4").End(xlDown).Row is throwing "Run time error 5".

Please help me


07-30-2010, 03:06 AM
Your thread title says 'run time error '6'. Then you say run time error 5.

Which is it?

I would note that you can get error 9 if the sheet is named differently (including if it has a leading/trailing space).

07-30-2010, 03:13 AM
sorry typo error. it is "6"

07-30-2010, 03:31 AM
So it says "Overflow", right?

Presuming yes, I see that you have lastrow dim'd as a "long", but that the "l" is in lowercase. Is that what it looks like in the code window?

The only thing I can think of is if you actually have lastrow declared as an Integer or Byte or ???


07-30-2010, 03:46 AM
Yes you correct. correcting that issue got resolved. Thanks a lot.

Can i request you for one more requirement.
I have 2 comboboxes viz..,
cbomodulename and cbofailurerate.

when i select a module from "cbomodulename" the corresponding failure rate calculated should reflect automatically in "cbofailurerate".

My code is as follows:

For i = 4 To 19 Step 1
cbomodulename.AddItem Sheets("GroundFixed").Range("A" & i).Text
Next i
cbomodulename.ListIndex = 0

lastrow = Sheets("GroundFixed").Range("A4").End(xlDown).Row

With cbofailurerate
For i = 4 To lastrow + 1 - 1

Sheets("GroundFixed").Range("D" & i).Value = multiply(Range("B" & i).Value, Range("C" & i).Value)
.AddItem Sheets("GroundFixed").Cells(i, 4)

Next i
End With

Please help me in developing code for the requirement said above.

Thanks a lot

07-30-2010, 03:55 AM
Not sure if I'll have the time to look right away, but for anyone wanting to help, please post a workbook with the UF's as you currently have them.


...when i select a module from "cbomodulename" the corresponding failure rate calculated should reflect automatically in "cbofailurerate"....

...explain that part again. Leastwise for me, I am not following.


07-30-2010, 04:04 AM
Thank you. I thnik i cant attach to the posts am posting here. Can you please provide me your id so that i can mail.

Repeating the requirement:
let me take an example
I have one combobox which has "Subjects" as items and other has "Marks" of states listed in combobox1".
When i choose "Mathematics" in combobox1, combobox2 should populate "99" (i.e., marks fetched in mathematics"). Please let me know incase further clarification needed.

Thank you.

07-30-2010, 04:39 AM
Use the Go Advanced button. Scroll down a bit and use Manage Attachments.

07-30-2010, 04:48 AM
Please find the sheet attached.

07-30-2010, 05:05 AM
New thread started here (http://www.vbaexpress.com/forum/showthread.php?p=221030#post221030).

Please don't start a new thread without putting a link to it.

Asking the same question in two different threads (or two different websites) is considered rude.