Copy Range of Cells into Clilpboard with cell borders

pingme89

Board Regular
Joined
Jan 23, 2014
Messages
176
Office Version
  1. 365
Platform
  1. Windows
I am trying to copy a range of cells into a the windows clipboard so I can paste it onto another workbook. Preferably I would like to be able to copy the cell borders as well.

This is what I have so far but it doesn't work.

Dim wbname As String
Dim Clipboard As MSForms.DataObject
Set Clipboard = New MSForms.DataObject


wbname = ActiveWorkbook.Name


If Search15.Value = True Then
LineNum = 15
End If
If Search16.Value = True Then
LineNum = 16
End If


Workbooks(wbname).Worksheets("Vehicle Lookup").Range("B14:O14").Copy
Workbooks(wbname).Worksheets("Temp Text").Range("A1:N1").PasteSpecial Paste:=xlPasteFormulas
Workbooks(wbname).Worksheets("Vehicle Lookup").Range("B" & LineNum & ":O" & LineNum).Copy
Workbooks(wbname).Worksheets("Temp Text").Range("A2:N2").PasteSpecial Paste:=xlPasteFormulas


Clipboard.SetText Workbooks(wbname).Worksheets("Temp Text").Range("A1:N2").Copy
Clipboard.PutInClipboard


I hope someone can help me figure this out.

Thanks in advance.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Specifically, I get a Run-Time Error '13'
Type Mismatch Error.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top