Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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) wrote in message ups.com... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanx Bob for your help,
However can I have a code which is like vice versa... mean for eg if i have : abc 1 abc 2 abc 3 xyz 2 xyz 3 xyz 5 hgf 3 hgf 4 hgf 3 and i have a button call CHANGE when i click on the button CHANGE abc 1 2 3 xyz 2 3 5 hgf 3 4 3 and when i have something like this 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 abc 1 abc 2 abc 3 xyz 2 xyz 3 xyz 5 hgf 3 hgf 4 hgf 3 hope you have understood what i ment... like vice versa Thank you in advance Regards |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to vlookup colume with different values | Excel Worksheet Functions | |||
Colume Headings | Excel Worksheet Functions | |||
How to change color of colume letter and row number? | Excel Discussion (Misc queries) | |||
3 COLUME CHART | Excel Worksheet Functions | |||
How can I look up max of one colume and display the colume to the. | Excel Worksheet Functions |