Get text from last and first cell in a column
kima wrote:
I have a timespan in column A:
05:54:04 2012/11/06
06:00:07 2012/11/06
..
06:23:14 2012/11/06
There are about 3000 mesurements.
Would like to make a header text with first and last cell texts:
05:54:04 2012/11/06 - 06:23:14 2012/11/06
Using a macro:
Chart.HasTitle = True
Chart.ChartTitle.Text = first text in column A "-" last text in column
A
You can try something like this:
x = Cells(1, 1).Value
If x = "" Then x = Cells(1, 1).End(xlDown).Value
y = Cells(Cells.SpecialCells(xlCellTypeLastCell).Row, 1).Value
If y = "" Then _
y = Cells(Cells.SpecialCells(xlCellTypeLastCell).Row, 1).End(xlUp).Value
Chart.ChartTitle.Text = x & " - " & y
If there's a header in row 1, change the first 2 lines as appropriate.
--
I will not bow down, I'll rise through the sun.
I'm transcending. I am claiming my throne.
We are immortal; we rise from the wraith; we are eternal.
You are my blood legion. My faith.
|