Script works depending on size of table

sunyem

New Member
Joined
Jun 28, 2017
Messages
14
Hello Everyone,

I have encountered some strange phenomenon when running a macro. So it uses the following formula to select the first empty cell in column B on a given sheet (which is activated earlier in the script):
Code:
Freecell = Range("B2:B" & Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row
Range("B" & Freecell).Activate
Now after running it a few times - hence filling some rows - it stops working at row 35 and at this step of the script prompts me an error.
The data entered by the macro goes into a table (just the one you can create in the 'HOME' menu. Now when I grabbed the bottom right corner of the tables border and decreased its size it was still working up to row 35. But when I extended the table til row 36 it stopped working at 36 - it fills some of the cells but not all the ones it is supposed to.
And here comes another mystery: when I run the VBA by clicking on the button it is linked to it gives me Error 400 but when I run it step by step using F8 it gives me the Run Time Error 1004 and does not fill even 1 cell.
At this point I am quite clueless what is wrong.

It might sound very hectic but I hope it is understandable.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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