Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Within say, E2:F20 are formulas returning results that are always neatly
bunched at the top. Blank: "" lines (null strings) if any, would appear below result lines within E2:F20. What I would like to do is for a sub to copy only the result lines within E2:F20 (omit the null string lines), then paste special as values into an adjacent 2 col range ie into G2:Hn*, & sort the pasted range by col G, ascending. *n may vary from 2 to 20 And if there are zero result lines, ie E2:F20 contains only null strings, then "No results to sort" will be written in G2. Thanks for insights. -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub Doit()
Dim i As Long Dim r As Range Range("E2:F20").Copy Range("G2").PasteSpecial xlValues For i = 20 To 2 Step -1 Set r = Cells(i, "G") If Trim(r.Text) = "" Then r.ClearContents If Trim(r.Offset(0, 1).Text) = "" Then _ r.Offset(0, 1).ClearContents Next Range("G2:H20").Sort Key1:=Range("G2"), _ Order1:=xlAscending, Header:=xlNo If Application.Count(Range("G2:H20")) = 0 Then Range("G2").Value = "No Results to Sort" End If End Sub -- Regards, Tom Ogilvy "Max" wrote: Within say, E2:F20 are formulas returning results that are always neatly bunched at the top. Blank: "" lines (null strings) if any, would appear below result lines within E2:F20. What I would like to do is for a sub to copy only the result lines within E2:F20 (omit the null string lines), then paste special as values into an adjacent 2 col range ie into G2:Hn*, & sort the pasted range by col G, ascending. *n may vary from 2 to 20 And if there are zero result lines, ie E2:F20 contains only null strings, then "No results to sort" will be written in G2. Thanks for insights. -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
OMIT BLANK LINES WHEN FORCING A CARRIAGE RETURN --- PLEASE HELP! | Excel Worksheet Functions | |||
copy formula down 1000,s of lines | Excel Worksheet Functions | |||
Whats the quickiest way to copy a formula down 13,000 lines in exc | Excel Discussion (Misc queries) | |||
Auto-copy of formula on inserted lines | Excel Discussion (Misc queries) | |||
Macro to copy range of formulas to equal data lines | Excel Worksheet Functions |