Transposing selected column headings
Hi Tom
Thanks for the code it worked very well.
Regards
Gareth
"Tom Ogilvy" wrote:
Sub Gar3th()
Dim rng As Range, rng1 As Range
Dim rng2 As Range, cell As Range
Dim i As Long, j As Long
Set rng = Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp))
Set rng = rng.SpecialCells(xlConstants)
For Each cell In rng
i = 0
For j = 2 To 16
Set rng1 = Cells(cell.Row, j)
Set rng2 = Cells(1, j)
If rng1.Text < "" And rng1.Text < "0" And _
UCase(rng1.Text) < "N" Then
cell.Offset(i, 16).Value = rng2.Value
cell.Offset(i, 17).Value = rng1.Value
i = i + 1
End If
Next
Next
End Sub
"Gar3th" wrote in message
...
Hi
In Excel 2000 I have a spreadsheet with a list of staff names in column
A. Columns B to P are head with different item types for which they can
sign. Under these headers is either a value or text entry. I have inserted
a blank row
for each header that contains an entry other than 0 or "N". Item and
Amount are additional column headers.
Name Invoices Petty Cash Cheques Holiday Forms Mat Leave Item
Amt
G Smith £1000 £100 0 Y N
J Brown 0 0 £100 Y Y
Jeff Black £500 £500 0 N N
Etc
Now I want to place the headers, where the entry is anything but 0 and
'N', in the blank rows starting in the next column Q headed Item and the
entry in the cell below in the column headed Amount to give:
Name Invoices Petty Cash Cheques Holiday Forms Mat Leave Item Amt
G Smith £1000 £100 0 Y N Invoices£1000
Petty Ca £100
Holiday F Y
J Brown 0 0 £100 Y Y Cheques £100
Holiday F Y
Mat Leave Y
J Black £500 £500 0 N N Invoices £500
Petty Ca £500
Etc
I will be extremely grateful if anyone can supply a solution.
Regards
Gareth
PS If Edwin Tam sees this it is a follow on from the auto insert you
provide
which has worked beautifully.
|