![]() |
Code to sort rows getting hung up by merged cells
Hi. I have two bits of code that are getting hung on the merged cells i have in rows 1, 2 and 3. I need to keep the merged cells so i need the following two bits of code to ignore these rows. Does anyone have any ideas please? (and thank you in advance).
' this first bit gets rid of any duplicate rows. Sub Getridof() Dim mc As Long Dim i As Long mc = 1 'column A Columns(mc).Sort Key1:=Cells(1, mc), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom For i = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1 If Cells(i - 1, mc) = Cells(i, mc) Then Rows(i).Delete Next i End Sub ' this bit is meant to sort column C into order. Range("C3").Sort Key1:=Range("C3"), Order1:=xlAscending, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Thanks. |
All times are GMT +1. The time now is 07:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com