Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy and Paste cells using VB

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy and Paste cells using VB

Otto,

Thanks a lot!!! That worked perfectly!

Dennis

On Jan 8, 5:00 pm, "Otto Moehrbach" wrote:
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 wrote in oglegroups.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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I copy big ranges of cells without drag or copy/paste? Ricardo Julio Excel Discussion (Misc queries) 3 March 23rd 10 02:38 PM
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy Cells/Paste Cells Programatically Brig Siton Excel Programming 2 August 29th 06 08:22 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
how can we copy cells comments text and paste to cells שי פלד Excel Discussion (Misc queries) 3 December 12th 05 05:16 AM


All times are GMT +1. The time now is 06:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"