View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Copy and Paste cells using VB

One way:
Sub Test()
Dim i As Range
For Each i In Range("B9:B649")
If i.Row Mod 2 < 0 Then _
i.Cut i.Offset(, -1)
Next i
End Sub
HTH Otto
wrote in message
ups.com...
Hi all! I am a new poster and also a neophyte Visual Basic user. I am
trying to create a macro that will cut the odd ranges in (B9:B649) to
(A9:A649). There is data in the even ranges I will want to move up in
column B when I get the odd data moved to column A. I've seen a lot of
options for ranges of consecutive cells but am lost when dealing with
random cells. My last attempt was:

Sub CutAndPaste()

Dim X As Integer
Dim Y As Integer
Dim Sum As Integer

Y = 1

For X = 8 To 648

Sum = X + Y
Range("BSum").Cut Destination:=Range("ASum")

Next
End Sub

I was hoping I could use the Sum value as my row indicator but it
doesn't work.
I appreciate any input!
Dennis