1

What I am trying to is that, I want to add multiple items into the clipboard then paste the second item when I press ctrl+q instead the first one. Here is my code but I'm getting the first one.

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+q
'


Dim DataObj As New MSForms.DataObject
Dim S As String


On Error GoTo NotText
DataObj.GetFromClipboard
S = DataObj.GetText 'take the first one into S
T = DataObj.GetText 'take the second one into T

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
NotText:
'don't want anything to happen.

ActiveCell.Value = T  'paste the second one(doesn't work)

End Sub
emrah
  • 140
  • 1
  • 7
  • as far as I can see, your both variables are storing the same value into S and T, so how it can be different? Is there something I am unable to understand? – Vikas Sep 12 '14 at 13:06
  • I know that they're storing the same value. I put this code to demonstrate what I'm trying to do. the Question is can I store the second when in T variable? is it possible or impossible? – emrah Sep 13 '14 at 14:51

0 Answers0