Integrar un for en macro
Publicado por JoaoM (222 intervenciones) el 13/05/2014 22:24:26
Hola amigos(as).
Pues eso, tengo esta macro y quiero integrarle este For para que no tenga que escribir tantos TextBox1, 2, 3 ect
Desde ya muchas gracias
Pues eso, tengo esta macro y quiero integrarle este For para que no tenga que escribir tantos TextBox1, 2, 3 ect
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
Private Sub cmb_cod_Client_Change() 'SELECCION DE CLIENTE
Sheets("Clientes").Activate
If cmb_cod_Client = Empty Then
cmb_cod_Client.ListIndex = 0
cmb_cod_Client.SetFocus
End If
var3 = cmb_cod_Client.Column(0) 'Cod Cliente RIF/CI
Cells.Find(What:=cmb_cod_Client.value, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
'xxxxxxxxx
ESTE EL For A INTEGRAR A LA MACRO
'For a = 1 To 6
'Cells(a, 1) = Me.Controls("TextBox" & a)
'Next a
'xxxxxx
'AQUI QUIERO NO ESCRIBIR TANTOS TextBox y reemplazar eso por un conteo For o com ose llame o diga
If var3 = ActiveCell Then
TextBox1 = ActiveCell.Offset(0, 1) 'Nombre
TextBox2 = ActiveCell.Offset(0, 2) 'Direccion
TextBox3 = ActiveCell.Offset(0, 3) 'Pueblo/Ciudad
TextBox4 = ActiveCell.Offset(0, 4) 'Telefono 1
TextBox5 = ActiveCell.Offset(0, 5) 'Telefono 2
TextBox6 = ActiveCell.Offset(0, 6) 'Fecha
End If
End Sub
Desde ya muchas gracias
Valora esta pregunta


0