View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default RangeName blocks of data

No code written to handle a single row name (two contiguous cells in column
A containing data)

Sub AddNames()
Dim rng As Range
Dim rng1 As Range
Dim rng2 As Range
Dim cell As Range
Set rng = Cells(Rows.Count, 2).End(xlUp)(2, 0)
rng.Value = "Dummy"
Set rng1 = Columns(1).SpecialCells(xlConstants)
For Each cell In rng1.Areas
If cell.Count 1 Then
' no stated requirement to handle this
Else
If cell.Row < 1 Then
Set rng2 = cell.Offset(-1, 0).End(xlUp)
Range(rng2, cell.Offset(-1, 0)).Resize(, 12).Name = rng2.Text
End If
End If
Next
rng.EntireRow.Delete
ActiveSheet.UsedRange
End Sub

--
Regards,
Tom Ogilvy


"CLR" wrote in message
...
Hi All........
I'm back with another Range problem, if someone would be so kind.

I have a database of 12 columns wide and several hundred rows high.

Column
A has only values in it's cells corresponding with the beginning of a
"datablock"...ie:, with a value in A1 and A10....all the data in row 1 to
whatever row is just above the next value in column A.........(in this

case
row 9) is associated with cell A1 and I would like to create a range of

that
block of cells, starting with A1 as upper left cell and these rows and 12
columns wide (A1:L9 in this case) .

The macro should continue to create the next block of data starting with

the
second value in column A and however many rows are below it to the next
value in column A, etc etc...as example, the third value in column A might

be
in A14, so the next Range should be established as A10:L13. In actual
practice, I will never know what the spacing down column A will be, nor

how
many values will be in column A, but the data will always be 12 columns

wide.

Each Range should bear the name of the value of it's respective Upper-left
cell found in column A.

Any assistance will be much appreciated.....

TIA
Vaya con Dios,
Chuck, CABGx3