Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need help on deleting row.

Below is a macro I created in sorting out a worksheet. The macro works well
but the only problem is that sort result have data that are not needed like
titles subtitles, etc. I need to add some more code to clean out the
unneeded rows which contain strings and are all over the rows and columns so
that when I execute the macro all I would see are the sorted data that I
want. Thanks for your help.


Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
--

--
scaps
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need help on deleting row.

Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1")
_
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range(Selection,
ActiveCell.SpecialCells(xlLastCell)).SpecialCells( xlConstants,
xlTextValues).EntireRow.Delete

perhaps. Test on a copy of your data.

--
Regards,
Tom Ogilvy


"Scaps" wrote in message
...
Below is a macro I created in sorting out a worksheet. The macro works
well
but the only problem is that sort result have data that are not needed
like
titles subtitles, etc. I need to add some more code to clean out the
unneeded rows which contain strings and are all over the rows and columns
so
that when I execute the macro all I would see are the sorted data that I
want. Thanks for your help.


Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
--

--
scaps



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need help on deleting row.

This does not work. It is giving an error message "Cannot use that command on
overlappping selections."
--
scaps


"Tom Ogilvy" wrote:

Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("B1")
_
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range(Selection,
ActiveCell.SpecialCells(xlLastCell)).SpecialCells( xlConstants,
xlTextValues).EntireRow.Delete

perhaps. Test on a copy of your data.

--
Regards,
Tom Ogilvy


"Scaps" wrote in message
...
Below is a macro I created in sorting out a worksheet. The macro works
well
but the only problem is that sort result have data that are not needed
like
titles subtitles, etc. I need to add some more code to clean out the
unneeded rows which contain strings and are all over the rows and columns
so
that when I execute the macro all I would see are the sorted data that I
want. Thanks for your help.


Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending,
Key2:=Range("B1") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=
_
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
--

--
scaps




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
Deleting the text without deleting the formula gems04 Excel Worksheet Functions 3 January 30th 09 11:21 PM
Deleting cell data without deleting formula Tom Hall Excel Discussion (Misc queries) 4 October 29th 06 04:07 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
how prevent formula in cell from deleting when deleting value???? sh-boom New Users to Excel 1 September 30th 05 06:12 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 07:12 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"