VBA code stops working at 53rd column

Euler271

New Member
Joined
Dec 4, 2017
Messages
31
I have VBA code in Access that creates an Excel workbook and fills a worksheet based on values in Access tables. The code fills five columns per state. (I have a state table that lists all 51 states, including DC.) My code stops working with "Error 1004 Method of 'Range 'of object'_Worksheet' failed" message. It always stops working when trying to insert something in column "BA", for some reason. In other words, in works just fine for the first two alphabets (A->Z and AA->AZ) but mysteriously stops with the error message in column "BA".

Does anyone have a clue why this is happening? I really need this to work. Thanks.
 
Oops.:eek:

Yes, there was a missing closing parenthisis.
Rich (BB code):
With xlWs
    .Range(.Cells(8, i + 4), .Cells(.Cells(xlWs.Rows.Count, 1).End(xlUp).Row, i + 4)).FormulaR1C1 = "=RC[-1]*RC[-2]"
End With
 
Upvote 0

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".

Forum statistics

Threads
1,223,975
Messages
6,175,749
Members
452,667
Latest member
vanessavalentino83

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