ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Blank rows appearing at top after sorting (https://www.excelbanter.com/excel-programming/287568-blank-rows-appearing-top-after-sorting.html)

gmangad[_8_]

Blank rows appearing at top after sorting
 
I have an excel file with names in Column 'A' which starts with "MR " O
"MRS " as prefix. and I have the formula in B as follows.
IF(A1="","",IF(LEFT(A1,3)="MR ",MID(A1,4,LEN(A1)-3),IF(LEFT(A1,4)="MR
",MID(A1,5,LEN(A1)-4),A1)))

It works perfect
and I am running the following macro to sort column B alphabeticaly
but after sorting, the empty rows are apprearing at beginning. Ca
anyone help me???????
Sub Macro4()
Range("A1:B" & Range("B500").End(xlUp).Row).Select
Selection.Sort Key1:=Range("b1"), Order1:=xlAscending, Header:=xlNo
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

End Sub

Thanks in advance
G

--
Message posted from http://www.ExcelForum.com


Max

Blank rows appearing at top after sorting
 
I've given you a reply in your multi-post in .worksheet.functions

--
hth
Max
-----------------------------------------
Please reply in thread
Use xdemechanik <atyahoo<dotcom for email
--------------------------------------------------------



Max

Blank rows appearing at top after sorting
 
Oops, correction. Should be:

I've given you a reply in your multi-post in .misc


Rgds
Max
-----------------------------------------
Use xdemechanik <atyahoo<dotcom for email
--------------------------------------------------------




All times are GMT +1. The time now is 11:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com