Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Paste Special

Status
Not open for further replies.

risk99

Technical User
Mar 23, 2003
44
US
Hi, I want to past/link my simple data as follow:

Data Source:
A1,B1,C1

And I just want to copy and paste my data from data source cells to the cells as follow:

A2,D2,G2 (want to have two blank cells between each number).

So, is there any way that I can just do this from Excel with VBA? If not, can you provide the VBA codes please? Thank you very much!!!
 
Sorry, I was tired...I meant Paste (I'm sure that you know what I meant)...and also I wanted to solve this in Excel without using VBA first. Thanks!!
 
I am not sure that I am understanding you right. If you want the values in A1, B1 and C1 in A2, D2 and G2, why not simply use (for example)=A1 in A2 etc.? If you need 'paste special', you will need to use VBA. Let us know what you want.
 
risk99,

It appears not to be an easy task (or not possible) without using VBA.

Here's a VBA routine...

Sub Move_Data()
Application.ScreenUpdating = False
[a1].Select
'Note: adjust next line for the # rows in your data.
For Each c In Range("A1:A200")
Move_Go
Next
Application.ScreenUpdating = True
[a1].Select
End Sub

Sub Move_Go()
ActiveCell.Offset(0, 1).Activate
ActiveCell.Cut
ActiveCell.Offset(0, 2).Activate
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Activate
ActiveCell.Cut
ActiveCell.Offset(0, 4).Activate
ActiveSheet.Paste
ActiveCell.Offset(1, -6).Activate
End Sub

You should copy and paste this into a Module. Then activate the "Move_Data" routine - which calls the "Move_Go" routine.

I tested the above and it does work, so I expect you should find the same result.

I hope this helps. :) Please advise as to how you make out.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Dale, thank you so much for your time!!! It really worked. But, if I have a longer series of numbers, I'll be in trouble. Say I have numbers from A1 to Z1. The codes for Move_Go will be so long, unleast I put a loop there. I've been having trouble to write the loop, please help!! Thanks again!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top