This is partially connected to the folowing thread707-659257 , click to read what I'm actually trying to achieve!
The only problem I have with this code now is that when it runs I get the following error:
GetText Invalid FORMATETC structure
And the line highlighted is the line marked red below.
All my references are correct, really don't know what's wrong! By the wayy, all hopeandpray() does is keep a record of the previous active cell in the sheet "Sheet5"
Cheers,
Pete
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call hopeandpray
Dim runCopy As Boolean, clipContents As String
Dim clipboardContents As DataObject
Set clipboardContents = New DataObject
clipboardContents.GetFromClipboard
clipContents = ""
clipContents = clipboardContents.GetText(1)
If Sheet5.Range("A1"
.Value = clipContents Then runCopy = True Else runCopy = False
If Range("A" & Target.Row).Value <> "" Then
With ActiveSheet
.CommandButton1.Top = ActiveCell.Top + (((ActiveCell.Height) / 2) - (CommandButton1.Height / 2))
End With
End If
If runCopy Then
On Error GoTo noSelections
Sheet5.Range("A1"
.Copy
noSelections:
End If
End Sub
The only problem I have with this code now is that when it runs I get the following error:
GetText Invalid FORMATETC structure
And the line highlighted is the line marked red below.
All my references are correct, really don't know what's wrong! By the wayy, all hopeandpray() does is keep a record of the previous active cell in the sheet "Sheet5"
Cheers,
Pete
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call hopeandpray
Dim runCopy As Boolean, clipContents As String
Dim clipboardContents As DataObject
Set clipboardContents = New DataObject
clipboardContents.GetFromClipboard
clipContents = ""
clipContents = clipboardContents.GetText(1)
If Sheet5.Range("A1"
If Range("A" & Target.Row).Value <> "" Then
With ActiveSheet
.CommandButton1.Top = ActiveCell.Top + (((ActiveCell.Height) / 2) - (CommandButton1.Height / 2))
End With
End If
If runCopy Then
On Error GoTo noSelections
Sheet5.Range("A1"
noSelections:
End If
End Sub