Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Representing autofill in macros

I have recorded number of Excel actions as a macro. One
of the actions is the as follows:

The sheet already has a number of rows of data in column
B.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Representing autofill in macros

Correction:
Sub CopyFormula()
For a = 1 To Range("B1").CurrentRegion.Rows.Count
Cells(a, 1).FormulaR1C1 = Cells(1, 1).FormulaR1C1
Next a
End Sub

-----Original Message-----
Luke,

Try the following:

Sub CopyFormula()
For a = 1 To Range("B1").CurrentRegion.Rows.Count
Cells(a, 1).Formula = Cells(a, 2).Formula
Next a
End Sub

-----Original Message-----
I have recorded number of Excel actions as a macro. One
of the actions is the as follows:

The sheet already has a number of rows of data in column
B.
In cell A1 is a formula, which I want to copy down as

far
as the data in column B.
I do this either by selecting cell A1, moving the cursor
to the bottom right- hand corner, and clicking on the
cross that appears. I could also do this by copying the
formula, holding down 'Shift', 'End' and the down-arrow

on
the keyboard and pasting the formula.

However, the macro records this action as

copying/pasting
to a set range. If I run the macro when there is a
different number of rows of data in column B, the macro
only copies down as far as it did when the macro was
recorded.

How can I get the macro to copy down as far as the data

in
column B regardless of the number of rows?

Thanks.

.

.

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
Macros-autofill down to one row above next data field Terry Excel Discussion (Misc queries) 2 July 31st 07 02:30 PM
Macros or the Fastest way to Autofill Rows klafert Excel Discussion (Misc queries) 1 September 30th 06 09:04 PM
macros for autofill klafert Excel Worksheet Functions 0 September 29th 06 04:44 PM
Recording macros with autofill andyiain Excel Discussion (Misc queries) 5 June 19th 06 03:33 PM
Autofill Indefinite Range in VBA/Macros igor Excel Programming 0 August 25th 03 11:25 PM


All times are GMT +1. The time now is 01:37 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"