Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Auto filling using macros

I have a spreadsheet that I need to reformat each month in order for it to be
imported into another application. The spreadsheet varies in length each
month, from say 100 lines one month to 600 lines the following month.

I have recorded a macro that deletes columns, creates formulae etc.
I wish to 'auto fill' the formulae I create down the entire length of a
column. However, the fact that the spreadsheet has a different number of
lines each month means that performing the autofill via a simple macro does
not work.

I know there is a bit of code that will allow me to find the last line in
the spreadsheet and autofill down to that line but I can't remember how to do
it. Any suggestions?

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Auto filling using macros

Here is an example code:

Range("B2").Formula = "=LOOKUP(A2,'Employee Numbers'!C:D)"
If Range("A3") "" Then
Range("B2", Range("A2").End(xlDown)).Offset(0, 1).FillDown
End If

This uses the last row of column A [Range("A2").End(xlDown))] as where to
fill down the formula in column B from B2.

Mike F
"bernard" wrote in message
...
I have a spreadsheet that I need to reformat each month in order for it to
be
imported into another application. The spreadsheet varies in length each
month, from say 100 lines one month to 600 lines the following month.

I have recorded a macro that deletes columns, creates formulae etc.
I wish to 'auto fill' the formulae I create down the entire length of a
column. However, the fact that the spreadsheet has a different number of
lines each month means that performing the autofill via a simple macro
does
not work.

I know there is a bit of code that will allow me to find the last line in
the spreadsheet and autofill down to that line but I can't remember how to
do
it. Any suggestions?

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Auto filling using macros

Thanks!

"Mike Fogleman" wrote:

Here is an example code:

Range("B2").Formula = "=LOOKUP(A2,'Employee Numbers'!C:D)"
If Range("A3") "" Then
Range("B2", Range("A2").End(xlDown)).Offset(0, 1).FillDown
End If

This uses the last row of column A [Range("A2").End(xlDown))] as where to
fill down the formula in column B from B2.

Mike F
"bernard" wrote in message
...
I have a spreadsheet that I need to reformat each month in order for it to
be
imported into another application. The spreadsheet varies in length each
month, from say 100 lines one month to 600 lines the following month.

I have recorded a macro that deletes columns, creates formulae etc.
I wish to 'auto fill' the formulae I create down the entire length of a
column. However, the fact that the spreadsheet has a different number of
lines each month means that performing the autofill via a simple macro
does
not work.

I know there is a bit of code that will allow me to find the last line in
the spreadsheet and autofill down to that line but I can't remember how to
do
it. Any suggestions?

Thanks in advance




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Auto filling using macros

I have a question about this Macro
My understanding is it looks at column A to determine how far to fill Column
B starting with cell B2.
What exactly does this portion

"=LOOKUP(A2,'Employee Numbers'!C:D)"

Have to do with it...I am getting some sort of error when I attempt to use
this macro in my spreadsheet

"Mike Fogleman" wrote:

Here is an example code:

Range("B2").Formula = "=LOOKUP(A2,'Employee Numbers'!C:D)"
If Range("A3") "" Then
Range("B2", Range("A2").End(xlDown)).Offset(0, 1).FillDown
End If

This uses the last row of column A [Range("A2").End(xlDown))] as where to
fill down the formula in column B from B2.

Mike F
"bernard" wrote in message
...
I have a spreadsheet that I need to reformat each month in order for it to
be
imported into another application. The spreadsheet varies in length each
month, from say 100 lines one month to 600 lines the following month.

I have recorded a macro that deletes columns, creates formulae etc.
I wish to 'auto fill' the formulae I create down the entire length of a
column. However, the fact that the spreadsheet has a different number of
lines each month means that performing the autofill via a simple macro
does
not work.

I know there is a bit of code that will allow me to find the last line in
the spreadsheet and autofill down to that line but I can't remember how to
do
it. Any suggestions?

Thanks in advance




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
Auto filling Forms ClintN Excel Worksheet Functions 1 June 1st 09 12:30 PM
Auto Filling ckane Excel Worksheet Functions 1 May 3rd 07 09:48 PM
Auto filling a row phil2006 Excel Discussion (Misc queries) 2 July 31st 06 12:33 PM
Auto Filling one sheet from another Titanus Excel Worksheet Functions 5 April 11th 06 03:45 AM
Auto Protecting cells & auto filling date ccarmock Excel Discussion (Misc queries) 7 September 30th 05 09:21 PM


All times are GMT +1. The time now is 02:08 AM.

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

About Us

"It's about Microsoft Excel"