800A03EC Unknown runtime error

dstelley

New Member
Joined
Jan 24, 2014
Messages
2
I have what is likely a simple answer but I cant see it. I've simplified as much as possible to show the error. This is VBScript manipulating Excel. The below code works fine. The second code does not. It throws a vague 800A03EC Unknown runtime error on the line that works with data.
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
intColumn = 2
for x = 0 to 20
objExcel.Cells(intRow, intColumn).value = x
objExcel.Cells(intRow, intColumn).Select
intRow = x + 1
intColumn = x + 1
next
Set objExcel = nothing
Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
intColumn = 2
for x = 0 to 20
strVal = "123R15"
intColumn = right(strVal,2)
objExcel.Cells(intRow, intColumn).value = x
objExcel.Cells(intRow, intColumn).Select
intRow = x + 1
intColumn = x + 1
next
Set objExcel = nothing
the error is on the line objExcel.Cells(intRow, intColumn).value = x Thanks in Advance
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You need to coerce intColumn to a true number:
Code:
intColumn = clng(right(strVal,2))
 
Upvote 0

Forum statistics

Threads
1,215,781
Messages
6,126,868
Members
449,345
Latest member
CharlieDP

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