View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default Selecting ranges of cells

.. contains about six columns ..
The first two .. for the next six ..


How about instead of copy/paste:
For iRow = iRowFirst To iRowLast
if cells(iRow, iCol) < "" then
zField = cells(iRow, iCol)
else
cells(iRow, iCol) = zField
End If
Next iRow

Dale wrote:
I just received a spreadsheet that contains about six columns.

The first two of these columns contain grouping information for the next six
columns, but only have the grouping level data in the first row of each group
of cells. I want to run a macro that will allow me to highlight a cell, have
it copy the contents of that cell and paste them in each cell below that one,
until the macro finds another cell that has data in it. It should then copy
that cell, and repeat the process.

I started out trying to just write the macro that will copy the current
selection, select the next group of rows that are blank, and paste the
result, but even that did not work. It looked like:

Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Range("B471:B484").Select
ActiveSheet.Paste

But the third row in this code is an absolute reference to cells, rather
than removing a single row from the selection. If someone could advise me on
how to change this code so that the third line just deselects the last line
from the previous line of code, that would meet my needs.

Thanks in advance.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----