View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Losse[_22_] Losse[_22_] is offline
external usenet poster
 
Posts: 1
Default Rearrange columns using VBA


Sure. If column A is supposed to be "Aaa" do:

Range("A1").Select
Do Until ActiveCell.Value = Aaa
ActiveCell.Offset(0, 1).Select
Loop
Selection.Name = Start
Do While ActiveCell < ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(-1, 0).Select
Selection.Name = End
Do While ActiveCell < ""
ActiveCell.Offset(0, -1).Select
Loop
Selection.Name = End2
Range("A1").Select
Selection.EntireColumn.Insert
Range("Start:End").Select
Selection.Copy
Range("A1:End2").Select
ActiveSheet.Paste


Just be sure to change the names for each of them. I'm sure there ar
much easier ways to do this, but this is the only way that comes t
mind

--
Loss
-----------------------------------------------------------------------
Losse's Profile: http://www.excelforum.com/member.php...fo&userid=2481
View this thread: http://www.excelforum.com/showthread.php?threadid=38764