View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jake[_5_] Jake[_5_] is offline
external usenet poster
 
Posts: 4
Default Finding/Moving Columns within Macro


So I need some advice/direction on how to perform this macro a little
more efficiently.
Everyday I export a report from our POS system at work into Excel. The
issue with the export is that none of the columns are in order so I
have to manually move the columns each time or create a macro to do
it. Currently I'm using the below code to find the column header and
move it to the correct location.

Dim intWarehouse

intWarehouse = Cells.Find(What:="Warehouse").Column
Columns(intWarehouse).Select
Selection.Cut Destination:=Columns("A:A")

I only have 15 columns that I need to find and then move but I would
think there has to be a more efficient way of doing this than creating
15 variables and using 3 lines of code for each column that I need to
find then move. For some reason I think I should be using an array but
after doing some research on arrays I'm even more confused on where to
start.

Is there a better way to do this? If so, can you point me in that
direction?

Thanks in advance -
Jake