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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,410
Messages
6,124,756
Members
449,187
Latest member
hermansoa

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