
Abrir Formulario con una tecla Función (F1 o F2)
Publicado por rafael (6 intervenciones) el 13/12/2014 00:13:12
Hola, tengo un código que abre un formulario con un evento Worksheet_BeforeDoubleClick en las columnas indicadas en mi código. Cómo puedo hacer para abrir el mismo evento también con una tecla Función como F1 o F2 ?
El código es el siguiente (adjunto archivo):
El código abre un formulario cada vez que se hace doble click sobre las columnas L, M,O, Y, Z, AA, AB desde la fila 10 en adelante. Me gustaría poder abrir el mismo formulario con una sola tecla como F1 o F2 si es que se puede.
Gracias y saludos.
El código es el siguiente (adjunto archivo):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim Source As String
Dim Cel As Range
If Target.Row > 9 Then
Select Case Target.Column
Case Is = 12
Cancel = True
Load FrmSelection
With FrmSelection
Set .Target = Target
For Each Cel In WSCountryCodes.Range("COUNTRY_NAME1")
.ListBoxSelection.AddItem Cel.Text
.ListBoxSelection.List(.ListBoxSelection.ListCount - 1, 1) = Cel.Offset(0, -2).Text
If Cel.Text = Target.Text Then
.ListBoxSelection.Selected(.ListBoxSelection.ListCount - 1) = True
End If
Next
.Show
End With
Case Is = 13, 15, 25 To 28
Cancel = True
If Target.Column = 13 Then
Source = "COMPANYTYPE2"
ElseIf Target.Column = 15 Then
Source = "PROJECTPHASE2"
ElseIf Target.Column = 25 Then
Source = "FUNCTIONALROLE2"
ElseIf Target.Column = 26 Then
Source = "MANAGEMENTLEVEL2"
ElseIf Target.Column = 27 Then
Source = "VERTICALMARKET2"
ElseIf Target.Column = 28 Then
Source = "CAMPAIGNTYPE2"
End If
Load FrmSelection
With FrmSelection
Set .Target = Target
For Each Cel In Intersect(Sheet1.Range(Source), Sheet1.Range(Source)(1, 1).EntireColumn)
.ListBoxSelection.AddItem Cel.Offset(0, 1).Text
.ListBoxSelection.List(.ListBoxSelection.ListCount - 1, 1) = Cel.Offset(0, 2).Text
If Cel.Offset(0, 2).Text = Target.Text Then
.ListBoxSelection.Selected(.ListBoxSelection.ListCount - 1) = True
End If
Next
.Show
End With
End Select
End If
ExitSub:
Set Cel = Nothing
End Sub
El código abre un formulario cada vez que se hace doble click sobre las columnas L, M,O, Y, Z, AA, AB desde la fila 10 en adelante. Me gustaría poder abrir el mismo formulario con una sola tecla como F1 o F2 si es que se puede.
Gracias y saludos.
- SF360_Import_Template_Final.zip(600,7 KB)
Valora esta pregunta


0