Coding Equivalent of CRL-A?
When in a worksheet I can manually select all cells by doing a control-A is there an equivalent I can use when coding?
I tried recording a macro and it just enters the particular range that was selected so is not dynamic in the way control-A is. I am trying to do this as a precondition before doing a sort on all the data. |
Quote:
ActiveWorkbook.Worksheets("SS").Sort.SortFields.Cl ear ActiveWorkbook.Worksheets("SS").Sort.SortFields.Ad d Key:=Sheet8.UsedRange, _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("SS").Sort .SetRange Range(?????????) .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With |
Quote:
Code works if set as follows ActiveWorkbook.Worksheets("SS").Sort.SortFields.Cl ear ActiveWorkbook.Worksheets("SS").Sort.SortFields.Ad d Key:=Range("A:A"), _ SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("SS").Sort .SetRange Sheet8.UsedRange .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With Hope this helps someone else save some pain |
Coding Equivalent of CRL-A?
Hi,
Am Wed, 19 Sep 2012 09:25:55 +0000 schrieb Caveman1957: When in a worksheet I can manually select all cells by doing a control-A is there an equivalent I can use when coding? try: ActiveSheet.UsedRange.Select Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Coding Equivalent of CRL-A?
On 19/09/2012 11:53 PM, Claus Busch wrote:
Hi, Am Wed, 19 Sep 2012 09:25:55 +0000 schrieb Caveman1957: When in a worksheet I can manually select all cells by doing a control-A is there an equivalent I can use when coding? try: ActiveSheet.UsedRange.Select Regards Claus Busch Try: Cells.Select HTH Mick. |
All times are GMT +1. The time now is 07:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com