'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.
'This uses the Data Object to put the collected text on the clipboard.
By storing data in a variable, I guess you mean to say add to the sheet cells
For that either you import the complete data and then remove what you need
or you open the file in the code and read line at a time and only use what you need to use. Generally speaking it is faster to import all then delete. but in some cases line by line is quicker and only thing that is possible.