View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RocketMan[_2_] RocketMan[_2_] is offline
external usenet poster
 
Posts: 19
Default Probably too easy...change range to be one row down.

Not quite.
FirstCell = FirstCell.Offset(1, 0).Address
will set the value to the offset address. So "pills" becomes $A$21.

:)


On Jan 30, 8:48*am, JLGWhiz wrote:
After the Find statement:

FirstCell = FirstCell.Offset(1, 0).Address

Then to get your sort range:

Set LastCell = ActiveSheet.Range("E65536").End(xlUp).Address

SortRange = Range(Firstcell & ":" & LastCell)



"RocketMan" wrote:
I use a cell.find command to find a row col with a certain item. *Now
I want to alter that so that its one row below after the find. *Here
is what I have so far:


Dim FirstCell As Range
Dim LastCell As Range
Dim SortRange As Range


Set FirstCell = ActiveSheet.Cells.Find(What:="Pills", After:=[A4],
LookIn:=xlFormulas, LookAt _
* * * * :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
* * * * False)


' need to set FirstCell to be one row lower to sort the data


Set LastCell = ActiveSheet.Range("E65536").End(xlUp) ' end of data
lines will be in E column
Set SortRange = ActiveSheet.Range(FirstCell, LastCell)
' ActiveSheet.SortRange.Sort ' use A column as key- Hide quoted text -


- Show quoted text -