Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Not sorted union range.

Hi NG

I'm union 2 SpecialCells type the best way I know.

In ('// Only test) I can see that my Union Range not is beginning with the
first cell, but with the firste cell from xlCellTypeFormulas and then
xlCellTypeConstants. Is there a way to "sort" NotEmptyCells.

snip start ****

'// My range is stepped Column by Columns.

On Error Resume Next

Dim NotEmptyCellsForm As Range
Set NotEmptyCellsForm = _
ColRange.Cells.SpecialCells(xlCellTypeFormulas, 23)

Dim NotEmptyCellsConst As Range
Set NotEmptyCellsConst = _
ColRange.Cells.SpecialCells(xlCellTypeConstants, 23)

On Error GoTo 0

If Not NotEmptyCellsForm Is Nothing And _
Not NotEmptyCellsConst Is Nothing Then

Dim NotEmptyCells As Range
Set NotEmptyCells = _
Application _
.Union(NotEmptyCellsForm, NotEmptyCellsConst)
ElseIf Not NotEmptyCellsConst Is Nothing Then
Set NotEmptyCells = NotEmptyCellsConst
ElseIf Not NotEmptyCellsForm Is Nothing Then
Set NotEmptyCells = NotEmptyCellsForm
End If

'// Only test
Dim NotEmptyCellsNew As Range
Set NotEmptyCellsNew = NotEmptyCells
Dim xx As Long
For xx = 1 To NotEmptyCells.Cells.Count
MsgBox NotEmptyCells.Cells(xx).Address
Next xx
snip end ****

--
Best regards
Joergen Bondesen



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
union range Atishoo Excel Programming 5 June 4th 08 03:02 PM
union range Curt Excel Discussion (Misc queries) 9 April 20th 07 02:32 PM
union range problem Walter Excel Programming 2 May 13th 06 12:28 AM
Union/Range/Cells KentÄ[_3_] Excel Programming 2 March 11th 05 11:14 AM
Union method for Range Object Chad Excel Programming 5 March 10th 05 08:02 PM


All times are GMT +1. The time now is 02:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"