RECORDING (Sorting) in Excel 2007 vs. Excel 2003

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15656
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

RECORDING (Sorting) in Excel 2007 vs. Excel 2003

Post by ChrisGreaves »

Excel 2007 records the sort operation differently than Excel 2003 says Dick Kusleika, and he has samples of recorded code to prove it.
For the experts, this just backs up what they've known for ages - pawing through the entrails of a recorded macro can help us understand the machinery in VBA, but a recorded macro isn't necessarily the best solution.

Dick's Blog item is frightening to me - it points out that "In this [2007] version, the range A1:E12 is hard-coded. When a new row is added, the 2003 code works the same and the 2007 code fails."

That sounds as if Recorded macros might be a bigger trap-in-waiting for many a novice macro-recorder than ever it was in 2003 or predecessors.

I'll avoid a rant along the lines of "After all these years how can they drop back into recording absolute addresses ..." and fail again.

(Seconds later) countered/augmented I see by Hans's Response to Stuart's post "I never did understand array formulae"
He who plants a seed, plants life.

User avatar
Jan Karel Pieterse
Microsoft MVP
Posts: 656
Joined: 24 Jan 2010, 17:51
Status: Microsoft MVP
Location: Weert, The Netherlands

Re: RECORDING (Sorting) in Excel 2007 vs. Excel 2003

Post by Jan Karel Pieterse »

Recorded macros have never been the best solution to create your macro's. They are a very good learning tool to get to know VBA and to get an impression of teh syntax needed for some actions. In fact, I often record small macros just to get all the arguments of an action, especially sort and find. Sounds like a good idea to leave Excel 2003 on my system so I can record the Sort action so it works on all versions!
Regards,

Jan Karel Pieterse
Excel MVP jkp-ads.com

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15656
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: RECORDING (Sorting) in Excel 2007 vs. Excel 2003

Post by ChrisGreaves »

Jan Karel Pieterse wrote:Recorded macros have never been the best solution to create your macros.
Jan, I quite agree. It looks as if a higher proportion of novices (who think that recording a macro is "Recording in VBA") are going to fall into this absolute-address trap, 'though.
He who plants a seed, plants life.