Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default using formulas in macros

I am using a macro to carry out a repeated task which includes copying a
selection of data into a separate worksheet . I then want to create a
formula with the copied data to create further info in another column.
However, how can I tell excel to copy the formula into all the rows which
hold the records, but only for those rows that do hold records. The number of
records copied into the worksheet can vary each time and I only want the
formula replicated in the rows of copied data. Hope this makes sense. Can
this be done and how do I do this?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default using formulas in macros

calculate the number of rows

NumRows = Cells(rows.Count,"A").End(xlUp).Row

and the autofill the formula, assuming you loaded it into A1

Range("A1").Autofill Range("A1").Resize(NumRows )

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"BBEXCELNOVICE" wrote in message
...
I am using a macro to carry out a repeated task which includes copying a
selection of data into a separate worksheet . I then want to create a
formula with the copied data to create further info in another column.
However, how can I tell excel to copy the formula into all the rows which
hold the records, but only for those rows that do hold records. The number

of
records copied into the worksheet can vary each time and I only want the
formula replicated in the rows of copied data. Hope this makes sense. Can
this be done and how do I do this?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default using formulas in macros

It is much easier to copy the formula down the whole column and then go back
and clear out the cells in which you don't want the formula.
--
Gary's Student


"BBEXCELNOVICE" wrote:

I am using a macro to carry out a repeated task which includes copying a
selection of data into a separate worksheet . I then want to create a
formula with the copied data to create further info in another column.
However, how can I tell excel to copy the formula into all the rows which
hold the records, but only for those rows that do hold records. The number of
records copied into the worksheet can vary each time and I only want the
formula replicated in the rows of copied data. Hope this makes sense. Can
this be done and how do I do this?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default using formulas in macros

Thank you very much for your response.
I perhaps did not make myself clear - I am not actually writing the macro
myself but using the excel macro record facility. How would I or where would
I insert Numrows? Sorry to seem rather thick!! Also would you be able to tell
me how to delete a number of blank rows in one of the worksheets also. The
blanks being above a list of data?

"Bob Phillips" wrote:

calculate the number of rows

NumRows = Cells(rows.Count,"A").End(xlUp).Row

and the autofill the formula, assuming you loaded it into A1

Range("A1").Autofill Range("A1").Resize(NumRows )

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"BBEXCELNOVICE" wrote in message
...
I am using a macro to carry out a repeated task which includes copying a
selection of data into a separate worksheet . I then want to create a
formula with the copied data to create further info in another column.
However, how can I tell excel to copy the formula into all the rows which
hold the records, but only for those rows that do hold records. The number

of
records copied into the worksheet can vary each time and I only want the
formula replicated in the rows of copied data. Hope this makes sense. Can
this be done and how do I do this?




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default using formulas in macros

I would need to see your recorded code to tell you, I can't read minds.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"BBEXCELNOVICE" wrote in message
...
Thank you very much for your response.
I perhaps did not make myself clear - I am not actually writing the macro
myself but using the excel macro record facility. How would I or where

would
I insert Numrows? Sorry to seem rather thick!! Also would you be able to

tell
me how to delete a number of blank rows in one of the worksheets also. The
blanks being above a list of data?

"Bob Phillips" wrote:

calculate the number of rows

NumRows = Cells(rows.Count,"A").End(xlUp).Row

and the autofill the formula, assuming you loaded it into A1

Range("A1").Autofill Range("A1").Resize(NumRows )

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"BBEXCELNOVICE" wrote in

message
...
I am using a macro to carry out a repeated task which includes copying

a
selection of data into a separate worksheet . I then want to create

a
formula with the copied data to create further info in another column.
However, how can I tell excel to copy the formula into all the rows

which
hold the records, but only for those rows that do hold records. The

number
of
records copied into the worksheet can vary each time and I only want

the
formula replicated in the rows of copied data. Hope this makes sense.

Can
this be done and how do I do this?






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
How to Evaluate Dynamic DDE Formulas MArcus Baffa Excel Worksheet Functions 5 September 12th 06 10:35 PM
how can i get formulas in excel to copy and paste? bman Excel Worksheet Functions 1 October 3rd 05 04:15 PM
Macros, How do I know what they do if I didn't create them. Abelg Excel Discussion (Misc queries) 1 September 17th 05 05:57 PM
Help with populating cells using formulas or macros dmsalvay1978 Excel Discussion (Misc queries) 2 August 31st 05 01:01 AM
calculating formulas for all workbooks in a folder Chad Excel Worksheet Functions 3 November 13th 04 05:22 PM


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