Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long, j As Long
Dim iLastRow As Long
Dim iLastCol As Long
With ActiveSheet
iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
If iLastCol > 1 Then
.Rows(i + 1).Resize(iLastCol - 2).Insert
.Cells(i + 1, "A").Resize(iLastCol - 2).Value = .Cells(i,
"A").Value
For j = 3 To iLastCol
.Cells(i + j - 2, "B").Value = .Cells(i, j).Value
.Cells(i, j).Value = ""
Next j
End If
Next i
End With
End Sub
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I am New to excel programing in VB,
> I want to know the code how to change the row to colume and colume to
> row
>
> for eg if i have : abc 1 2 3
> xyz 2 3 5
> hgf 3 4 3
>
> and i have a button call CHANGE
>
> when i click on the button CHANGE
>
> the data should be viewed as below
>
>
> abc 1
> abc 2
> abc 3
>
> xyz 2
> xyz 3
> xyz 5
>
> hgf 3
> hgf 4
> hgf 3
>
> can anyone let me know the code
>
> and can i can i know where i lean online for programing in VB
>
> Thanks in advance
>
> Regards
>
|