Sharid
Well-known Member
- Joined
- Apr 22, 2007
- Messages
- 1,064
- Office Version
- 2016
- Platform
- Windows
Hi
My following code, pastes from clipboard. I have set the Control Source for Textbox2 as Cover!$B$2 as I want the data pasted in to B2 down.
This is the problem
It pastes ALL of the data in B2, so if I have copied 10 rows it pastes all data in B2, where as I would like it to paste the first row in B2 and the B3 and so on
My following code, pastes from clipboard. I have set the Control Source for Textbox2 as Cover!$B$2 as I want the data pasted in to B2 down.
This is the problem
It pastes ALL of the data in B2, so if I have copied 10 rows it pastes all data in B2, where as I would like it to paste the first row in B2 and the B3 and so on
VBA Code:
Private Sub CommandButton6_Click()
'Pastes from ClipBoard
Dim objdataobject As MSForms.DataObject
Set objdataobject = New MSForms.DataObject
objdataobject.GetFromClipboard
If Me.TextBox1.Value = "" Then
Me.TextBox1.Value = objdataobject.GetText
Exit Sub
End If
End Sub