vba: autofill dynamic range / error

Status
Not open for further replies.

Rotating_Potato

New Member
Joined
Oct 9, 2015
Messages
8
0down votefavorite
Hi there,

My code is:

<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;"> Sub autofill_dynamic()

Workbooks
(file_main).Worksheets("sheet1").Activate
ActiveSheet
.Range("R52").End(xlDown).Activate
ActiveSheet
.Range(ActiveCell, ActiveCell.Offset(0,198)).Select
Selection
.AutoFill Worksheets("sheet1").Range(Selection, Selection.Offset(-61,0))

EndSub

</code>What I'm trying to achieve: move to the bottom of the data from the selected cell R52, select all the cells by offsetting to 198 cells, and autofill the table to the top by 61 cells up.
The subroutine provides me with the error 1004 (the operation requires the cells to be identical in size). I did unmerge all cells in the range.

<tbody>
</tbody>
 
Last edited:

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".
If you are going to cross-post - make it less obvious and don't include the hyperlink from where you have copied and pasted!
 
Upvote 0
@ Lee, actually if the poster is going to cross-post then they should post the link and actually make it more obvious as per the forum rules

Rule #10:
We prefer that members do not cross-post questions to other forums, but when this does occur members should make clear that they have cross-posted and provide links to the cross-posts. Cross-posted questions that do not comply may be deleted or locked. Serial offenders may have their posting privileges revoked. For a discussion on the issues with cross-posting, see this link: Excelguru Help Site - A message to forum cross posters
 
Upvote 0
@ Lee, actually if the poster is going to cross-post then they should post the link and actually make it more obvious as per the forum rules

I know - but how he's done it though is very unintentional. It's more luck, than judgement
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,093
Latest member
catterz66

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