Macro Copy/Paste Help

  • Thread starter Thread starter esi
  • Start date Start date
E

esi

Trying to design a macro that will take a multiple column range say B1:C25
and copy all cells with values, move them up 1 cell and then paste value. I
found was doing this manually and the whole process take forever when
you're dealing with multiple cells and worksheets.

Thanks
 
esi,

We need more information.

What do you do with a value in Cell B1? Where do you move it to?

Do you only move values to currently blank cells? Is the whole range
shifted, or just some cells?

Post back...
Bernie
 
Sub MoveUp()
Dim RangeToMove As Range
Dim x, y, z as Integer

Set RangeToMove = Selection

If RangeToMove.Areas.Count = 1 Then

RangeToMove.Copy
RangeToMove.Offset(-1, 0).PasteSpecial Paste:=xlValues

x = RangeToMove.Rows.Count - 1
y = RangeToMove.Columns.Count - 1

For z = 0 To y
RangeToMove.Offset(x, z).Range("A1").ClearContents
Next z

End If
RangeToMove.Select
End Sub



esi wrote
 
Back
Top