Home > OS >  [o] VBA in EXCEL the comparison table column value from fixed to the length of the variable how to m
[o] VBA in EXCEL the comparison table column value from fixed to the length of the variable how to m

Time:10-07

EXCEL the length of a column value by fixed 5 becomes variable how to modify the code?
Table 1 and table 2 than
In table 3 is in table 1 with table 2 without copying all in
Table 4 is table 1 and table 2 at the same time, all the copies in

The code is as follows:

Private Sub CommandButton1_Click ()
N1=Sheets (1). The Range (" C "& amp; 65535). The End (xlUp). Row
N2=Sheets (2). The Range (" C "& amp; 65535). The End (xlUp). Row
For I=2 To n1
T=0
For j=2 To n2
If UCase (Trim (Left (Sheets (1). The Range (" C "& amp; I), 5)))=UCase (Trim (Left (Sheets (2). The Range (" C "& amp; J), 5))), Then the
T=1
End the If
Next j
If t=0 Then
X=x + 1
Sheets (3). The Range (" B "& amp; X)=Sheets (1). The Range (" B "& amp; I)
Sheets (3). The Range (" C "& amp; X)=Sheets (1). The Range (" C "& amp; I)
Sheets (3). The Range (" D "& amp; X)=Sheets (1). The Range (" D "& amp; I)
Sheets (3). The Range (" E "& amp; X)=Sheets (1). The Range (" E "& amp; I)
Sheets (3). The Range (" F "& amp; X)=Sheets (1). The Range (" F "& amp; I)

End the If

Next I

For I=2 To n1
T=0
For j=2 To n2
If UCase (Trim (Left (Sheets (1). The Range (" C "& amp; I), 5)))=UCase (Trim (Left (Sheets (2). The Range (" C "& amp; J), 5))), Then the
T=1
The Exit For
End the If
Next j
If t=1 Then
Y=y + 1
Sheets (4). The Range (" B "& amp; Y)=Sheets (1). The Range (" B "& amp; I)
Sheets (4). The Range (" C "& amp; Y)=Sheets (1). The Range (" C "& amp; I)
Sheets (4). The Range (" D "& amp; Y)=Sheets (1). The Range (" D "& amp; I)
Sheets (4). The Range (" E "& amp; Y)=Sheets (2). The Range (" E "& amp; J)
Sheets (4). The Range (" F "& amp; Y)=Sheets (2). The Range (" F "& amp; J)
End the If

Next I
  • Related