, , . .
. ( , , !):
1) | Sub 1() |
2) | Range("A1:A10").Select |
3) | Selection.Font.Italic = True |
4) | Selection.Borders(xlDiagonalDown).LineStyle = xlNone |
5) | Selection.Borders(xlDiagonalUp).LineStyle = xlNone |
6) | With Selection.Borders(xlEdgeLeft) |
7) | .LineStyle = xlDot |
8) | .Weight = xlThin |
9) | .ColorIndex = 5 |
10) | End With |
11) | With Selection.Borders(xlEdgeTop) |
12) | .LineStyle = xlDot |
13) | .Weight = xlThin |
14) | .ColorIndex = 5 |
15) | End With |
16) | With Selection.Borders(xlEdgeBottom) |
17) | .LineStyle = xlDot |
18) | .Weight = xlThin |
19) | .ColorIndex = 5 |
20) | End With |
21) | With Selection.Borders(xlEdgeRight) |
22) | .LineStyle = xlDot |
23) | .Weight = xlThin |
24) | .ColorIndex = 5 |
25) | End With |
26) | With Selection.Borders(xlInsideVertical) |
27) | .LineStyle = xlDot |
28) | .Weight = xlThin |
29) | .ColorIndex = 5 |
30) | End With |
31) | With Selection.Borders(xlInsideHorizontal) |
32) | .LineStyle = xlDot |
33) | .Weight = xlThin |
34) | .ColorIndex = 5 |
35) | End With |
36) | Range("A1").Select |
37) | End Sub |
, , . 4 5- , , [8] (.. 8, 13, 18, 23, 28 33) ( 26 30).
1 , :
1) | Sub () |
2) | Range("A1:A10").Select |
3) | Selection.Font.Italic = True |
4) | With Selection.Borders(xlEdgeLeft) |
5) | .LineStyle = xlDot |
6) | .ColorIndex = 5 |
7) | End With |
8) | With Selection.Borders(xlEdgeTop) |
9) | .LineStyle = xlDot |
10) | .ColorIndex = 5 |
11) | End With |
12) | With Selection.Borders(xlEdgeBottom) |
13) | .LineStyle = xlDot |
14) | .ColorIndex = 5 |
15) | End With |
16) | With Selection.Borders(xlEdgeRight) |
17) | .LineStyle = xlDot |
18) | .ColorIndex = 5 |
19) | End With |
20) | With Selection.Borders(xlInsideHorizontal) |
21) | .LineStyle = xlDot |
22) | .ColorIndex = 5 |
23) | End With |
24) | Range("A1").Select |
25) | End Sub |
:
1. 2- . , , . , , .. , . , Cells:
|
|
Range(Cells(1,1),Cells(m,1)).Select
m .
:
Range(Cells(n,q),Cells(m,p)).Select
n m , q p .
2. , . 2- 3- :
Range("A1:A10").Font.Italic = True
(4) (7) [9]:
With Range("A1:A10").Borders(xlEdgeLeft)
.LineStyle = xlDot
.ColorIndex = 5
End With
3. , , , :
WorkSheets(". ").Range("A1:A10").Font.Italic _
= True
With WorkSheets(". ").Range("A1:A10"). _
Borders(xlEdgeLeft)
.LineStyle = xlDot
.ColorIndex = 5
End With
:
Workbooks(" .xls"). _
WorkSheets(". ").Range("A1:A10").Font.Italic = True
With Workbooks(" .xls"). _
WorkSheets(". ")Range("A1:A10"). _
Borders(xlEdgeLeft)
.LineStyle = xlDot
.ColorIndex = 5
End With
:
1. . (2) (24) 11- . .
2. 2 . :
2.1. 2 (Excel ), Excel ,
2.2. ( C:\St):
Path = "C:\St" '
= Dir(Path) '
i = 1
While <> "" '. 8.3
Cells(i,2).Value =
= Dir
i = i + 1
Wend
2.3. .xls .
Path = "C:\St\ .xls" |
Filename = Dir(Path) |
If Filename <> "" Then |
' ': |
= vbYesNo + vbQuestion + vbDefaultButton1 |
' : |
= MsgBox((" " & Filename & _ " . ?"), ) |
Select Case |
Case vbYes |
MsgBox " !" |
Case vbNo |
MsgBox " !" |
End Select |
Else |
MsgBox " " & Filename & " !" |
End If |
2.4. , :
:
- ("")
- .
. .
|
|
, . , . , , : Range1- .
Dim Range1 As Object
Set Range1 = Worksheets(1).Range("A1")
, 2.3 (. 29) A1:A10. , .
Sub ()
Workbooks(" .xls"). _
WorkSheets(". ").Range("A1:A10").Font.Italic = True
With Workbooks(" .xls"). _
WorkSheets(". ")Range("A1:A10"). _
Borders(xlEdgeLeft)
.LineStyle = xlDot
.ColorIndex = 5
End With
...
' ! J
End Sub
, , . MyRange A1:A10, .xls . :
1) | Sub () |
2) | Dim MyRange As Object |
3) | SetMyRange = Workbooks(" .xls"). _ WorkSheets(". ").Range("A1:A10") |
4) | MyRange.Font.Italic = True |
5) | With MyRange.Borders(xlEdgeLeft) |
6) | .LineStyle = xlDot |
7) | .ColorIndex = 5 |
8) | End With |
9) | With MyRange.Borders(xlEdgeTop) |
10) | .LineStyle = xlDot |
11) | .ColorIndex = 5 |
12) | End With |
13) | With MyRange.Borders(xlEdgeBottom) |
14) | .LineStyle = xlDot |
15) | .ColorIndex = 5 |
16) | End With |
17) | With MyRange.Borders(xlEdgeRight) |
18) | .LineStyle = xlDot |
19) | .ColorIndex = 5 |
20) | End With |
21) | With MyRange.Borders(xlInsideHorizontal) |
22) | .LineStyle = xlDot |
23) | .ColorIndex = 5 |
24) | End With |
25) | Range("A1").Select |
26) | End Sub |
:
1. 3 .
2. . , .