#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Autofill in macro

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofill in macro

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Autofill in macro

The filling in this case goes as far as G845, but I am creating a macro which
will ran with different amount of data so there will be other times where the
filling will be less than 845 and others where it will be more than 845.
Thanks for your help

Orquidea
"Dave Peterson" wrote:

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofill in macro

I don't understand.

Does this mean that you can't pick out a column to determine the number of rows?

If you were doing it manually, how would you know when to stop?

orquidea wrote:

The filling in this case goes as far as G845, but I am creating a macro which
will ran with different amount of data so there will be other times where the
filling will be less than 845 and others where it will be more than 845.
Thanks for your help

Orquidea
"Dave Peterson" wrote:

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 132
Default Autofill in macro

I will be using the macro to run in data that I dump from other computer
system. The dumped file will be with diferent ranges of dates, therefore the
number of rows will vary according to the length of time I run the raw report.

Your subprocedure worked well, Thanks for your help

"Dave Peterson" wrote:

I don't understand.

Does this mean that you can't pick out a column to determine the number of rows?

If you were doing it manually, how would you know when to stop?

orquidea wrote:

The filling in this case goes as far as G845, but I am creating a macro which
will ran with different amount of data so there will be other times where the
filling will be less than 845 and others where it will be more than 845.
Thanks for your help

Orquidea
"Dave Peterson" wrote:

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Autofill in macro

Ah. I thought you had a follow up question in your previous message.

orquidea wrote:

I will be using the macro to run in data that I dump from other computer
system. The dumped file will be with diferent ranges of dates, therefore the
number of rows will vary according to the length of time I run the raw report.

Your subprocedure worked well, Thanks for your help

"Dave Peterson" wrote:

I don't understand.

Does this mean that you can't pick out a column to determine the number of rows?

If you were doing it manually, how would you know when to stop?

orquidea wrote:

The filling in this case goes as far as G845, but I am creating a macro which
will ran with different amount of data so there will be other times where the
filling will be less than 845 and others where it will be more than 845.
Thanks for your help

Orquidea
"Dave Peterson" wrote:

Can you look at a different column to determine how far to do the filling?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
.range("g2").autofill _
destination:=.range("g2:g" & lastrow)
end with

I used column A to get that last row.

orquidea wrote:

Hi
I want to replace in the subprocedure below the part ("G2:G875") with un
undeterminated number of rows, something with xlFillDefault. My concern is
that if I have more rows than 875 it is not going to copy the formula that I
am copying with the autofill.

Range("G2").AutoFill Destination:=Range("G2:G875")

Thanks in advance

Orquidea

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofill macro formulas Leona Excel Worksheet Functions 0 July 6th 07 04:54 PM
Dynamic range for autofill macro Jim G Excel Discussion (Misc queries) 2 April 23rd 07 05:46 AM
Macro to autofill column [email protected] Excel Discussion (Misc queries) 1 June 21st 06 04:21 PM
Autofill macro Mike G Excel Discussion (Misc queries) 6 April 21st 05 01:33 AM
autofill macro glee Excel Discussion (Misc queries) 1 February 14th 05 05:14 PM


All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"