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.
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.