Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use VB to invert ranges

Hello all, I am new to using groups for help. Please forgive me
because this will be wordy.

I have a scenario in which I need to take a single row in Excel, which
contains multiple connected values, along with a unique ID, e.g.

A B C D E F G H
I
1234 AA 23874 BB 2893 CC 58374 DD 29834

Column A would be the unique ID, and the following columns would
contain the connected values. So column B would be connected to column
C, column D connected to E, so on and so forth up to 12 possible
connections, equalling 24 columns.

I need to invert this into a vertical format. The final result would
for the above example would be:

A B C
1234 AA 23874
1234 BB 2893
1234 CC 58374
1234 DD 29834

I am very much a beginner with VBA. I would like to keep this as
simple as possible because I will be leaving my current position
sometime in the next few months and would like to have this in place
for my team before I leave. Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Use VB to invert ranges

It's a little sloppy but here's one way:

Sub test()
Dim countD As Integer, countR As Integer

countD = 2
countR = 4

Do Until Cells(1, countR) = ""
Cells(1, countR).Cut Cells(countD, 2)
Cells(1, countR + 1).Cut Cells(countD, 3)
countR = countR + 2
countD = countD + 1
Loop

End Sub

--
Dan Oakes

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Use VB to invert ranges

Missed the first column...

Sub test()
Dim countD As Integer, countR As Integer

countD = 2
countR = 4

Do Until Cells(1, countR) = ""
Range("A1").Copy Cells(countD, 1)
Cells(1, countR).Cut Cells(countD, 2)
Cells(1, countR + 1).Cut Cells(countD, 3)
countR = countR + 2
countD = countD + 1
Loop

End Sub

--
Dan Oakes

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 invert 2 series? Feejo Charts and Charting in Excel 1 January 1st 08 04:15 PM
Invert a column Jakobshavn Isbrae Excel Worksheet Functions 5 June 13th 07 01:30 AM
how do you invert a column Chris Excel Discussion (Misc queries) 7 August 21st 06 11:42 PM
Invert Picture Qaspec Excel Programming 1 November 7th 05 08:23 PM
Invert Text Gary's Student Excel Discussion (Misc queries) 2 May 14th 05 03:00 AM


All times are GMT +1. The time now is 09:01 AM.

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

About Us

"It's about Microsoft Excel"