Hi Sandy,
Thanks (it was my getstarted.htm web page that was mentioned).
Many people start out with macros by recording a macro.
John already gave you a macro to do your first question.
Before starting I would highly recommend installing
MarkCells macro, to create some test data,
http://www.mvps.org/dmcritchie/excel/join.htm#markcells
so you can start with marked cells to be able to tell where
a cell was when you marked it by creating test data with
the address of the cell when the macro is run.
i.e. Select A1:W80 for instance and run the macro
(you can use the name box to supply the range)
When you move things around you will know where data
originally came from.
Now you can record a macro and modify it to make it more
generic.
Alt+F8, Macro, Record Macro
Have it go into your personal.xls (see bottom of dialog)
accept the name assigned probably Macro1
Select columns you want to move
Hold the shift key and grab the column boundary below
the gray column headers and drag to it's new location
for insertion. Stop Recording (the black square).
You will generate something like this:
Sub Macro18()
Columns("D:Q").Select
Selection.Cut
Columns("S:AF").Select
Selection.Insert Shift:=xlToRight
End Sub
which you can convert manually to something like:
Sub Move_DQ_ltof_S()
Columns("D:Q").Select
Selection.Cut
Columns("S").Select
Selection.Insert Shift:=xlToRight
End Sub
cols A:C same as original
Col D original column R
Col E:R original column D:Q
Col S:xx original column S:xx
BTW, Now that you know how to install a Macro and a User Defined
Function, the proper newsgroup for future threads would be the
excel.programming newsgroup.
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm