Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to invert 2 series? | Charts and Charting in Excel | |||
Invert a column | Excel Worksheet Functions | |||
how do you invert a column | Excel Discussion (Misc queries) | |||
Invert Picture | Excel Programming | |||
Invert Text | Excel Discussion (Misc queries) |