ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Code Question for Newbe (https://www.excelbanter.com/excel-programming/277709-macro-code-question-newbe.html)

DataMan

Macro Code Question for Newbe
 
Scenario:
I have a worksheet that has Column A and Column B, each containing 10
rows of data, that need to be added together and their sum displayed in
column C.

I want to copy this formula in Column C 10 rows down.

I want to write a macro that will do this but I want the macro to be
able to do the same operation in a file that would have any number or
rows to be added. I do not want to have this formula copied to all the
rows in Column C. Just the rows that have data to be added.

How would I code this?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Jim Rech

Macro Code Question for Newbe
 
There are many way to do that. Here's one:

Range("B1", Range("B1").End(xlDown)).Offset(0, 1).FillDown

--
Jim Rech
Excel MVP



DataMan[_2_]

Macro Code Question for Newbe
 
Thanks, It worked exactly like I wanted it to.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com