Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change from row to colume n colume to row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Change from row to colume n colume to row

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change from row to colume n colume to row

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to vlookup colume with different values Bklynhyc Excel Worksheet Functions 2 October 13th 09 07:28 PM
Colume Headings Gu y Excel Worksheet Functions 1 November 30th 07 12:40 PM
How to change color of colume letter and row number? DK Excel Discussion (Misc queries) 1 June 6th 07 08:33 PM
3 COLUME CHART BANDIT Excel Worksheet Functions 0 March 21st 06 07:17 PM
How can I look up max of one colume and display the colume to the. Brian Cornejo Excel Worksheet Functions 2 February 21st 05 05:47 AM


All times are GMT +1. The time now is 05:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"