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

Trying to use the following to simply copy the active cell contents to the
next column over and for the next 20 rows. Getting late. Why is this
ignoring the column Offset?
Thanks.


Sub Macro2()
'
' Macro2 Macro
' Macro recorded 3/6/2005 by Michael
'
' Keyboard Shortcut: Ctrl+z
ActiveCell.Copy
Dim MyArray(1 To 20) As Variant
For i = 1 To 20
X = MyArray(i)
ActiveCell.Offset(1, X).Select
ActiveSheet.Paste
Next i
End Sub

--
WWW
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Simple Copy and Paste

Not sure exactly what you were trying to achieve, but the problem was
you did not
feed values to your array :(

Sub Macro2()
ActiveCell.Copy
Dim MyArray(1 To 20) As Variant
For v = 1 To 20
MyArray(v) = v
Next v
For i = 1 To 20
X = MyArray(i)
ActiveCell.Offset(1, X).Select
ActiveSheet.Paste
Next i
End Sub

But i would say, why use array, if the array value and array position
is identical?
look at code below.
Sub Macro_Mine()
ActiveCell.Copy
For i = 1 To 20
ActiveCell.Offset(1, i).Select
ActiveSheet.Paste
Next i
End Sub

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
Line copy - Not just a simple copy paste Ninerref Excel Worksheet Functions 3 September 10th 09 11:44 AM
Copy & paste simple problem Paul Excel Programming 2 December 1st 04 10:10 PM
Simple Copy & Paste Bob Barnes[_3_] Excel Programming 3 February 20th 04 11:09 PM
Help! What's wrong with this simple copy and paste Richard James[_3_] Excel Programming 4 November 23rd 03 12:57 AM
Simple copy and paste Fritz[_2_] Excel Programming 2 November 22nd 03 01:56 PM


All times are GMT +1. The time now is 08:47 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"