1004 Autofill with row counter variables

puskacpj

Board Regular
Joined
Jul 29, 2011
Messages
102
The report is based on the number of tickets that owners have and are aged. I copy the owner list and remove duplicates and I count and save to: tot_ownnew_cnt. There are 5 different sections on each sheet based on the severity group. (severity 1,2,3,4,5) I age owner tickets in each group. I use tot_ownnew_row for where I'm at and when I do the autofill, I want it to take the current info in columns B:I and fill to the last owner entry. Basically it is:
tot_ownnew_row = 103
tot_ownnew_cnt = 197

Range("B103:I103").Select
Selection.AutoFill Destination:=Range("B103:I197"), Type:=xlFillDefault
Range("B103:I197").Select

That would be: "B" & tot_ownnew_row &":I" & tot_ownnew_cnt &""


Selection.AutoFill Destination:=Range("B" & tot_ownnew_row & ":I" & tot_ownnew_cnt & ""), Type:=xlFillDefault
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You've shown your new code using the variables. But what selection does your code make prior to that line of code?

In fact you don't need to make a selection ... refer to the range directly, like:
Code:
Range("B" & tot_ownnew_row & ":I" & tot_ownnew_row).AutoFill Destination:=Range("B" & tot_ownnew_row & ":I" & tot_ownnew_cnt), Type:=xlFillDefault
 
Upvote 0
Thank you for helping. This is what I have. It is giving the 1004 error:
AutoFill metod of Range class failed

Range("B" & tot_ownew_row & "I" & tot_ownnew_row & "").Select

tot_ownnew_cnt = tot_ownnew_cnt + tot_ownnew_cnt

Selection.AutoFill Destination:=Range("B" & tot_ownnew_row & ":I" & tot_ownnew_cnt & ""), Type:=xlFillDefault


tot_ownnew_row is the first row in that Severity Aging section.
tot_ownnew_cnt is the last row to autofill. This is making my head hurt. :(
 
Upvote 0
Your variables have various spellings. Use Option Explicit and DIM your variables to prevent such spelling mistakes.
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,153
Members
452,891
Latest member
JUSTOUTOFMYREACH

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