Macro Copy/Paste Help

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
 
B

Bernie Deitrick

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
 
C

Chrissy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top