View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vic[_4_] Vic[_4_] is offline
external usenet poster
 
Posts: 7
Default Offset from end of a selection

I am trying to copy variable number of cells and then paste them. Then
I am trying to do an Offset form the last cell of the pasted cells. If
I have more than one cell being pasted, the following works great:

Selection.End(xlDown).Activate

However, if there is only one cell being pasted, that syntax will
activate the last cell in the column instead (cell #65536 at the
bottom of the page).

Here is a snippet with my attempt:

Set compRow = Cells.Find(What:="component(s):",
After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

Set zipRow = Cells.Find(What:="Zip File:", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
' selects rows of components between comprow and zip row
Range(compRow.Offset(1, 0), zipRow.Offset(-2, 0)).Select

Selection.Copy
Sheets("Condensed ChangeLog").Select
ActiveCell.Offset(0, 1).Select
ActiveSheet.Paste

Selection.End(xlDown).Activate


Thank you for any help.