MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VBA code for sorting

  Asked By: Alex    Date: Jan 11    Category: MS Office    Views: 2314

How do you write a vba code to sort an entire row of data based on a
number value on a particular column where the heading is dynamic
(meaning changes) for each different section of the spreadsheet. I
have this formatted excel template that has a button that when
clicked on it dumps data into this formated template from a text file
source. This template has several sections and a rolling 12 month
period. At first I set the sort by going to the menu bar - data, sort
and picked the column to sort on which was column L. But I couldn't
just pick column L because it would sort every section of the report
the same way. Being that this formatted template has several section
where the sort differs from section to section I picked the headings
for each of the sections that was on column L which in this case was
Dec-05. The problem with doing it this way was since it's a rolling
month, the heading of Dec-05 that used to reside on column L was now
Jan-06 so when the new data was brought into this template it messed
up the sorting cause it was sorting based on Dec-05 and it should
have sorted on Column L that now has a heading of Jan-06. I don't
want to have to manually always adjust the sort every month when I
bring in the new data. Is there a way to automate this using VBA?



No Answers Found. Be the First, To Post Answer.

Didn't find what you were looking for? Find more on VBA code for sorting Or get search suggestion and latest updates.