Sendkeys

dulitul

New member
Joined
Dec 13, 2012
Messages
16
Reaction score
0
Points
0
Hey,

I was wondering if you could use sendkeys in an if statement combination.

I ve got data in excel that I have to paste in another programme.

I adjusted my macro in such a way that it copies automatically a value that I paste in the programme (I click ctrl +V). When I press ctrl + v I want another value in my sheet to be copied automatically so that I can paste it in another cell in the programme (by clicking ctrl + v again).
The problem is that when I press ctrl + v by the time excel is inactive therefore I have to use sendkeys combination (ctrl + v).

It write sth like

If sendkeys "^v", true then
Cells..copy

However, it doesnt allow me to put sendkeys in if statement as a condition. It says - compile error expected: then or go to

Can you help me out?

Thanks
 
I may not understand exactly,
But when I copy something, I use double click.
In behind your sheet write something like this:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Select Case MsgBox("Did you save your work ?", vbYesNo, "?SAVE?")
Case vbYes
'If ActiveCell.Column <> 0 And ActiveCell.Row <= 3200 Then
ComptL = ActiveCell.Row
Titre = Cells(ComptL, 2)
Sector = Cells(ComptL, 3)
Nom = Cells(ComptL, 4)
'Cells(ComptL, 2).Select
Deplace1
'End If
Case vbNo
End Select
End Sub

Correct it as you need.
 
Back
Top