View Single Post
  #6   Report Post  
walkingfern walkingfern is offline
Junior Member
 
Posts: 5
Default

Well, this was a new experience. ;-)

1. I've never opened Visual Basic.
2. I've never even used a macro.
3. I have a Mac.

Found online instructions for how to create a macro in Visual Basic.
Copied and pasted the macro.
Hit the F5 key.
Same problem. It sorts on Column A and Column B has a mind of its own.

Tried again and got a runtime error. Hit "debug" and it highlighted the line:

LRow = Cells(Rows.Count, 2).End(xIUp).Row

One of these days, I'll have to try learning new things. I just wish I understood why Excel doesn't follow its own instructions.

Thank you for providing me with a new experience!


Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Mon, 23 Dec 2013 16:51:30 +0000 schrieb walkingfern:

Yes, Column A is correctly sorted. However, Column B is all awry. I
thought that maybe it had something to do with the sort order of Column
C, so I eliminated that from the "sort by" but it's still out of order.


try following macro for your column B and then try sorting again:

Sub Test()
Dim LRow As Long
Dim rngC As Range

LRow = Cells(Rows.Count, 2).End(xlUp).Row
For Each rngC In Range("B1:B" & LRow)
rngC = WorksheetFunction.Clean(Trim(rngC))
Next
End Sub


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2