Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Lucille Holmes   on Aug 25 In MS Office Category.

  
Question Answered By: Juanita Mason   on Aug 25

Set a variable to get the address of the deleted row (strStart). Set
another variable to get the end of the selection (strEnd). The set
your range using the two variables as the start and end points.

I just tested the example below.

Sub SortRange
Dim strStart As String
Dim strEnd As String
Dim strSheet As String

strSheet = ActiveSheet.Name

strStart = ActiveCell.Address

strEnd = ActiveCell.Offset(20, 5).Address

Worksheets(strSheet).Range(strStart, strEnd).Sort key1:=Worksheets
(strSheet).Range(strStart), _
key2:=Worksheets(strSheet).Range(strEnd)

End Sub

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on I'm stuck . . . can you help, please? Or get search suggestion and latest updates.


Tagged: