Thread: Is it possible?
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Is it possible?

Hi
these are both only ONE line. Combine them to a single line and it
should work

--
Regards
Frank Kabel
Frankfurt, Germany


JA wrote:
I am expriencing compile error at the following lines:

Set oCell = .Range("A1").Resize(1, cCols).Find(Cells(i,
"A").Value, , xlFormulas)

.Cells(cNewRow + 1, oCell.Column).Value = Cells(i,
"B").Value

-----Original Message-----
Here is a macro to place it on an other sheet

Sub transpose()
Dim cRows As Long
Dim cCols As Long
Dim cNewRow As Long
Dim i As Long
Dim oCell As Range

cRows = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To cRows
With Worksheets("Sheet2")
cNewRow = Asc(Cells(i, "B").Value) - 64
cCols = .Cells(1, Columns.Count).End (xlToLeft).Column
If .Range("A1") = "" Then
cCols = 0
Set oCell = Nothing
Else
Set oCell = .Range("A1").Resize(1,
cCols).Find(Cells(i, "A").Value, , xlFormulas)
End If
If oCell Is Nothing Then
.Cells(1, cCols + 1).Value = Cells

(i, "A").Value
.Cells(cNewRow + 1, cCols + 1).Value = Cells(i,
"B").Value Else
.Cells(1, oCell.Column).Value = Cells (i, "A").Value
.Cells(cNewRow + 1, oCell.Column).Value = Cells(i,
"B").Value
End If
Set oCell = Nothing
End With
Next i
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"JA" wrote in message
...
Is it possible to transpose Table 1 to Table 2 using
macros?

TABLE 1
Start_Date Course Duration
08/05/04 A 2
09/05/04 B 1
09/05/04 C 3
08/05/04 D 3
10/05/04 E 2

TABLE 2
08/05/04 09/05/04 10/05/04 11/05/04
A A
B
C C C
D D D
E E



.