EXCEL VBA copy row 1 to X rows down

Dan Nielsen

New Member
Joined
Jan 10, 2018
Messages
6
Hi

I have been using a large EXCEL sheet with a lot of VBA. But suddenly a line does not work.. (It has been working for a long time).

I get
Run-time error '1004':
Markeringen er for stor.
(The marked area is to big)

It works but only to 4000 rows, if there more i fails.

I have the same line working in a old version (with more then 6000 rows) of the file, but i have changes so much since :(

_______________________________________
Rem Udvid ark
Dim RowNo As Long
RowNo = Workbooks("LetOptik").Worksheets("FakturaLinje_DB").Range("A" & Rows.Count).End(xlUp).Offset(3).Row 'RowNo er blevet defineret i Modul1 "Option Explicit Public RowNo As Long"
If RowNo < 5 Then RowNo = 5


Workbooks("LetOptik").Worksheets("Salgsoversigt").Range("A5:BM5").AutoFill Destination:=Workbooks("LetOptik").Worksheets("Salgsoversigt").Range("A5:BM" & RowNo), Type:=xlFillDefault 'Kopier formler til resten af ark.
____________________________________________
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi there. Have you checked what row number is actually being determined? It is possible that the row number is coming out much bigger than 4000. Put a 'msgbox RowNo' line in after your RowNo= statement (or a breakpoint in the VBA editor) and see what it shows.
 
Upvote 0
So, what value is the MsgBox returning for the RowNo value?
Do you have any merged or protected cells on your sheet?
 
Upvote 0
6224
Ny workaround is a Line Thats first Copy to rød no 4000 and then then The vba gode that chef total likes to Copy and Copy from row 4000. Og Worlds but When i have over 8000 roes again i Will have The problem
 
Upvote 0
You did not answer my second question.
 
Upvote 0
Around the rows where the errors occur, is there any strange data, like maybe some formulas that are returning errors?
If not, it is going to be hard to figure out what might be going on without seeing the data and complete code you are working with.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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