Results 1 to 2 of 2

Thread: Sendkeys

  1. #1


    Register for a FREE account, and/
    or Log in to avoid these ads!


    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

    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?


  2. #2
    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
    'End If
    Case vbNo
    End Select
    End Sub

    Correct it as you need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts