Limited byrows propagate a value via macro to all cells in column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to propagate the value "1" to all cells in a column via macro. The
number of cells will vary based on the data loaded at file open. I do not
want to create additional rows by inserting a formula and copying it to an
entire column. I am using Excel 2003.
 
Let's say you want to insert 1's into the first open column, and match the size to the number of
rows in column A:

Cells(1, Columns.Count).End(xlToLeft)(1, 2).Resize _
(Cells(Rows.Count, 1).End(xlUp).Row).Value = 1

HTH,
Bernie
MS Excel MVP
 
Bernie Deitrick said:
Let's say you want to insert 1's into the first open column, and match the size to the number of
rows in column A:

Cells(1, Columns.Count).End(xlToLeft)(1, 2).Resize _
(Cells(Rows.Count, 1).End(xlUp).Row).Value = 1

HTH,
Bernie
MS Excel MVP





Thank you Bernie, I hope it works. I will try it. Can you give me advice as to how to implement this solution.
Is there an area where I key it in so that it will execute when the data is
loaded or do I have to activate it in some other way?
Thank you for your help.
 
THANK YOU BERNIE THAT IS JUST WHAT I NEED.

You're welcome....

Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top