AboutGyula Gulyas Expertise I can answer most questions related to macros, worksheet functions, VBA, Office automation (calling/using other MS Office programs) and geocoding using Google Maps. I have 10 years experience using and programming in MS Excel and other office applications. I have extensive experience linking and using DLLs in Excel.
Experience Macros, worksheet functions, VBA, linking of DLLs and Office automation, geocoding using Google Maps.
Question Hi Gyula,
Just wondering if i have a column or row of data how I could flip it around to reverse the order.
Thanks,
Brian
Answer Brian,
here you go from David's site:
ReversI() can be used to reverse the order of items in a row, column, or range. It can be used to reverse itself. Applied to a SINGLE ROW, the macro will flip about a vertical axis, or a horizontal axis for a column; otherwise, it really isn't a flip. Obviously you must select the range (i.e. A1:A30) and not the entire row or column. If you selected an entire row for instance your data would be so far to the right that it would take you awhile to find it. If you select a range of columns and rows the item in the upper left will reappear in the lower right corner. What previously was ordered down will be up, and what ran left to right will run right to left. You may notice the division by two; if the item count is not divisible by two the center item will not be switched. Infrequent use does not justify a shortcut key. See Samples below for an example of usage.
Sub ReversI()
'David McRitchie 1998-07-30 documented in
' http://www.mvps.org/dmcritchie/excel/join.htm
'Reverse (Flip) Item values in Range, Row, or Column [Ctrl+R]
'Counting in multiple rows/cols, item count proceeds down a
'column in range and continues top of next column in range
Dim tcells As Long, mCells As Long, ix As Long, ox As Long
Dim iValue As Variant
tcells = Selection.Count
mCells = tcells / 2
For ix = 1 To mCells
iValue = Selection.Item(ix).Value
ox = tcells + 1 - ix
Selection.Item(ix).Value = Selection.Item(ox).Value
Selection.Item(ox).Value = iValue
Next ix
End Sub
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here