Search : in
By :

Macro Help In Excel COPY PASTING

Last answer on Sep 26, 2008 6:51:45 pm BST theloniousmonk, on Sep 24, 2008 9:57:36 pm BST 
 Report this message to moderators

Hello,

I am trying to copy data from a excell spread sheet that is actually a set template i.e.

Name:John Doe Age:17

Job: Painter Favorite Food: Pizza

I think it would be easy to copy the fields since they are stationary and move to a different book or atleast copy onto clipboard then be able to paste like


First Name JOB FOOD Age Less Than Me
------------------------------------------------------------­--------
John Doe Painter Pizza 6

Configuration: Windows 2003
Internet Explorer 7.0

Best answers for « Macro Help In Excel COPY PASTING » in :
Excel – Macro for copy & paste selected range Show Excel – Macro for copy & paste selected range Issue Solution Note Issue I have a summary of data by month in one sheet and the raw data in another sheet. Instead of creating multiple worksheets for my raw data for each month, I want...
Copy/Paste problems when using Firefox ShowCopy/Paste problems when using Firefox Pushow Adware Extensions It happens that sometimes, Firefox refuse to copy/paste items. Two assumptions can be made: Pushow Adware You have been infected by an adware, named pushow**.dll...
Copy, Paste and Cut not functioning ShowCopy, Paste and Cut not functioning Issue Solution Issue I am having a problem, every time i want to copy, paste and cut my files, it's not working. Even am trying to use the keyboard combinations, CTRL+X, CTRL+C, and CTRL+V but it's...
Quick Copy/Paste under Ubuntu ShowQuick Copy/Paste under Ubuntu Intro Uses: Intro Under Ubuntu there is a quicker alternative to make a Copy/Paste other than using the native CTRL V and CTRL C combinations . You simply select the target text (it is uploaded in...

1

 DAOQ, on Sep 26, 2008 6:51:45 pm BST
  • +6

Will This Help ? (below...)

'Macro to copy the text in several cells on several worksheets to the clipboard for pasting.
Public Sub CopyIt()

'I assume you will loop through several worksheets in a workbook so I created a sheet object.
Dim Sheet As Excel.Worksheet

'I made a variable to hold the text from the cells.
Dim Txt As String

'I created a data object to use with the clipboard.
'You must have 'Microsoft Forms 2.0 Object Library' checked in "Tools" - "References"
'in order to use the 'DataObject' type.
Dim MyData As New DataObject

'Clear the text.
Txt = ""

'Loop through each of the sheets in the workbook...
'If you only want one worksheet then you don't need the loop or the sheet variable,
' instead you can use 'ActiveSheet' or name the sheet directly.
For Each Sheet In ActiveWorkbook.Sheets

'Add each cell in the sheet to the text variable using the cells function.
'I just put numbers in this one the numbers you have will depend on where the data is
'in your form. ( the vbtab tells it to move over by one column before the next data is added. )
Txt = Txt & Sheet.Cells(4, 5) & vbTab
Txt = Txt & Sheet.Cells(6, 5) & vbTab
Txt = Txt & Sheet.Cells(8, 5) & vbTab
Txt = Txt & Sheet.Cells(4, 7) & vbTab
Txt = Txt & Sheet.Cells(6, 7) & vbTab
Txt = Txt & Sheet.Cells(8, 7) & vbTab 'You could put the vbCrLf below here instead of vbTab.

'This tells it to add a return and line feed so the data from the next sheet
'will go to the next line instead of one big long line.
Txt = Txt & vbCrLf

'Finish the loop.
Next Sheet

'This uses the Data Object to put the collected text on the clipboard.
MyData.SetText Txt
MyData.PutInClipboard

'You are now ready to paste !

End Sub

Reply to DAOQ