View Single Post
 
Old 11-18-2019, 06:33 PM
Bumba Bumba is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Jan 2019
Posts: 26
Bumba is on a distinguished road
Default How to move a selection one cell up using VBA?

I'm trying to remove the last cell from a selection dynamically and copy the range.

The worksheet looks like the attached image.

I'm trying to select and copy the range C3:C8 dynamically using VBA.

I've tried the below code:
Code:
Cells.Find(What:="id", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
        xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
        , SearchFormat:=False).Activate
    ActiveCell.Offset(1, 0).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Offset(-1, 0).Select.Copy Range("E5")
But I'm getting Run-time error '424': Object required. Also if I remove the Copy method the selection is shown to be C2:C8 and not C3:C8.

Help !?
Attached Images
File Type: png Untitled.png (6.9 KB, 19 views)
Reply With Quote