Visual Basic - () Excel. Visual Basic Excel : , , , .
. , 㭭 . : , , , .
, . , . , , . ( ), , , . , , .
. . , , .
, .
, () , .
, , . , .
, , . , . , .
, . , , , . , .. .
Visual Basic Excel , , , , , . .
- . .
|
|
- .
, . , , . , Value , .
, , . - .
, . , . ,
. ,
. =.
Power, Value, :
Power. Value = 3 Value 3
X = Power. Value x value.
VBA. . . 4.1.
4.1
VBA Excel
Application () | Excel, MS Excel. |
Workbook ( ) | , , , . ActiveWorkBook . |
Worksheets ( ) | , , . ActiveWorkSheet - , . |
Window () | , . ActiveWindow |
Range () | , , , , . . . : Activeell - . Range. |
, . . 4.2
4.2
VBA
Application | ActiveWindow ActiveWorkBook ScreenUpdating StandardFont | |
WorkBook | ActiveSheet FullName Name Saved | , . . , ( False, ) |
Worksheet | Name Previons ProtectContents Visible | . ( ). |
Window | ActiveCell DisplayGridlines Selection Visible WindowState | . . ( , , ) |
Range | Column Font Formula Name Row Value Worksheet |
, ( ):
|
|
1) 14 .
ActiveCell.Font.Size=14
Size Font;
2) Courier New Cyr
ActiveCell.Font.Name = Courier New Cyr
Name Font;
3)
ActiveCell.Font.Italic=True.
, ( , ). . 4.3.
4.3
VBA
Application | Quit Undo | MSExsel |
Workbook | Activate Close Save SaveAs | . . . . |
Worksheet | Activate Calculate Delete Protect Unprotect | . . . . . |
Window | Activate Close | . . |
Range | Clear ClearContents ClearFormats Offset Select | . . . , . |
.
4.1
: , . .
Sub Info()
' B1
Worksheets("1").Range("B1").Value =Worksheets.Count
' B2
Worksheets("1").Range("B2").Value=AktiveWorkBook.FullName
' B3.
Worksheets("1").Range("B3").Value = Worksheets(3).Name
End Sub
4.1
, , , , , .
: add.
4.2
, .
Microsoft Excel .
, Microsoft Excel, , . Visual Basic WorkBook WorkBooks.
With
With , . , , , With, , , .
|
|
With < >
<>
End With
With,End With ,
< > Excel,
<> VBA, < >. .
1:8 20 With.
Range( 1:8 ).Font.Bold=True
Range( 1:8 ).Font.ColorIndex=3
Range( 1:8 ).Font.Size=20
With .
With Range(1:8).Font
.Bold=True
.ColorIndex=3
.Size=20
End With
VBA .
, , , , , , . VBA , .
, -. , , . , , . , .
, ( , , , ..), , .
VBA . , , Windows. . , , , .
, , . . .
. , , .
TextBox | ||
Label | ||
CommandButton | ||
ListBox | ||
ComboBox | ||
ScrollBar | ||
SpinButton | ||
OptionButton | ||
CheckBox | ||
ToggleButton | ||
Frame | ||
Image | ||
RefEdit | RefEdit | |
MultiPage | ||
TabStrip |