您的当前位置:首页正文

vba对象的属性

2020-09-19 来源:易榕旅网
第4章Range(单元格)对象选取单元格

选取与某值不同的单元格

合并单元格区域活动单元格已用的单元格空行围成的单元格可视单元格区域公式引用的单元格从属单元格特殊单元格选取

偏移单元格调整单元格单元格总数

A列最后非空一行第一行最后非空一列隐藏行列

设置行高列宽设置列宽行高(厘米)设置列宽行高(英寸)自动调整单元格设置滚动区域输入公式

是否有公式单元格是否有数组公式单元格

设置为数组公式单元格引用样式

单元格剪切单元格复制将单元格复制成图片

选择性粘贴

插入行列

删除行列

清除单元格

拼音指南

批注设置

超链接设置

数据有效性设置

单元格填充设置

单元格数字设置

单元格对齐设置

单元格字体设置

单元格边框设置

单元格图案设置

单元格保护设置

[A1].Select[A1:D8].Select

[A1:D8,A20:C25,F6:G10].Select[A:A].Select[A:D].Select

[A:A,C:C,H:H].Select[1:1].Select[5:20].Select

[1:1,3:3,5:5].SelectCells.Select

Sheets(1).Columns(\"A\").ColumnDifferences(Comparison:=Sheets(1).[A1]).SelectUnion(Range(\"A1:B10\"),Range(\"D1:E10\"),Range(\"G1:G10\"))Range(Range(\"A1:B10\"),Range(\"D1:E10\"),Range(\"G1:G10\"))ActiveCell

ActiveSheet.UsedRange

[a1].CurrentRegion.Rows.CellsActiveWindow.VisibleRange[a1].Precedents

Application.Evaluate([a1].Formula)[a1].Dependents

Activesheet.cells.SpecialCells(x,y).Selectx为:

xlCellTypeAllFormatConditionsxlCellTypeAllValidationxlCellTypeBlanksxlCellTypeCommentsxlCellTypeLastCellxlCellTypeVisible可见

xlCellTypeSameFormatConditionsxlCellTypeSameValidationxlCellTypeConstantsxlCellTypeFormulas

当x为xlCellTypeConstants或xlCellTypeFormulas时y为:xlErrorxlLogicalxlNumbersxlTextValues[a1].Offset(x,y)Resize(x,y)

Sheet(1).Cells.Count

Range(\"A65536\").End(xlUp).RowRange(\"IV1\").End(xlToLeft).Column[a1].EntireRow.Hidden=True/False[a1].EntireColumn.Hidden=True/False

Rows(1).Hidden=True/FalseColumns(1).Hidden=True/FalseRows.Hidden=True/False

Cells.Rows.Hidden=True/FalseColumns.Hidden=True/False[A1].RowHeight=n[A1].ColumnWidth=n

Application.CentimetersToPoints(1)Application.CentimetersToPoints(2)Application.InchesToPoints(1)Application.InchesToPoints(0.5)[A1].EntireColumn.AutoFit[A1].EntireRow.AutoFitSheets(1).ScrollArea=[a1]Sheets(1).ScrollArea=\"\"[a1].Formula=\"=TODAY()\"[a1].HasFormula=True/False[a1].HasArray=True/False

[A1].FormulaArray=\"数组公式\"[A1].Address

[A1].Address(False,False)

[A1].Address(RowAbsolute:=False)[A1].Address(ColumnAbsolute:=False)[A1].Address(ReferenceStyle:=xlR1C1)

[A1].Address(False,False,ReferenceStyle:=xlR1C1)

[A1].Address(RowAbsolute:=False,ReferenceStyle:=xlR1C1)[A1].Address(ColumnAbsolute:=False,ReferenceStyle:=xlR1C1)[A1].CutDestination:=[b1][A1].CopyDestination:=[b1][A1].Copy[b1]

[A1].CopyPicturexlScreen,xlBitmap[B1].Select

[B1].Parent.Pictures.Paste[A1].Copy

[B1].PasteSpecialPaste:=x,Operation:=y,SkipBlanks:=True/False,Transpose:=True/Falsex为:

xlPasteAll

xlPasteAllExceptBordersxlPasteColumnWidthsxlPasteCommentsxlPasteFormatsxlPasteFormulas

xlPasteFormulasAndNumberFormatsxlPasteValidationxlPasteValues

xlPasteValuesAndNumberFormatsy为:

xlPasteSpecialOperationNonexlPasteSpecialOperationAdd

xlPasteSpecialOperationSubtractxlPasteSpecialOperationMultiplyxlPasteSpecialOperationDivide[A1].InsertShift:=xlToRight[A1].InsertShift:=xlDown

[A1].EntireRow.InsertShift:=xlShiftDown

[A1].EntireColumn.InsertShift:=xlShiftToRight[A1].DeleteShift:=xlUp[A1].DeleteShift:=xlToLeft

[A1].EntireRow.DeleteShift:=xlUp

[A1].EntireColumn.DeleteShift:=xlToLeft[A1].ClearFormats[A1].ClearContents[A1].ClearComments[A1].ClearNotes[A1].Clear[a1]=\"拼音\"

[a1].Characters(1,3).PhoneticCharacters=\"pinyin\"[a1].Phonetic.Visible=TrueWith[a1]

.Comment.Delete

.AddComment.Text/\"批注内容\".Comment.Visible=False

.Comment.TextText:=\"插入内容\EndWith

[a1].NoteText

Sheets(1).Hyperlinks.Delete

Sheets(1).Hyperlinks.AddAnchor:=[a1],Address:=\"\

Sheets(1).Hyperlinks.AddAnchor:=[a1],Address:=\"路径\示\"

[a1].Validation.AddType:=x,AlertStyle:=

_xlValidAlertStop,Operator:=y,Formula1:=\"100\"x为:

xlValidateWholeNumberxlValidateDecimalxlValidateDatexlValidateTime

xlValidateTextLengthxlValidateList

y=xlEqual,Formula1:=\"1,2,3,4,5,6,7,8,9,10,11,12\"y=xlBetween,Formula1:=\"=$D$1:$D$10\"y为:

xlBetween后面加:Formul2:=\"1000\"

xlGreaterxlLess

xlGreaterEqualxlLessEqualxlNotEqualxlEqual

.IgnoreBlank=True.InCellDropdown=True.InputTitle=\"整数\".ErrorTitle=\"数据错误\".InputMessage=\"请输入整数\".ErrorMessage=\"数据超出了范围\".IMEMode=xlIMEModeOff.ShowInput=True.ShowError=True

[A1:A20].Cells(1).Value=x

[A1:A20].Cells(1).AutoFillDestination:=[A1:A20],Type:=yy为:

xlFillDaysx为日期型xlFillFormats

xlFillSeriesx为数值/公式xlFillWeekdaysx为日期型xlGrowthTrendxlFillCopyxlFillDefault

xlFillMonthsx为日期型xlFillValuesx为数值/公式xlFillYearsx为日期型xlLinearTrend

[a1].NumberFormatLocal=xx为:

G/通用格式0_

#,##0.00_);[红色](#,##0.00)yyyy-m-dh:mm:ss0

# ?/?##0.0E+0@

[DBNum1][$-804]G/通用格式[DBNum2][$-804]G/通用格式[A1].HorizontalAlignment=xx为:

xlHAlignLeftxlHAlignRightxlHAlignCenter

xlHAlignFill

xlHAlignCenterAcrossSelectionxlHAlignDistributedxlHAlignGeneralxlHAlignJustify

[A1].VerticalAlignment=xx为:

xlVAlignCenterxlVAlignJustifyxlVAlignBottom

xlVAlignDistributedxlVAlignTop

[A1].Orientation=0°~360°[A1].AddIndent=True[A1].WrapText=True[A1].ShrinkToFit=True[a1:a2].Merge[a1:a2].UnMerge

[a1].MergeCells=True[a1].Font.Name字体名称

#VALUE!

[a1].Font.Size=n

[a1].Font.ColorIndex=n[a1].Font.Underline=xx为:

xlUnderlineStyleNonexlUnderlineStyleSinglexlUnderlineStyleDouble

xlUnderlineStyleSingleAccountingxlUnderlineStyleDoubleAccounting[a1].Font.Strikethrough=True/False[a1].Font.Subscript=True/False[a1].Font.Superscript=True/False[a1].Borders(x).ColorIndex=n[a1].Borders(x).LineStyle=y[a1].Borders(x).Weight=zx为:xlEdgeTopxlEdgeBottomxlEdgeLeftxlEdgeRightxlDiagonalDownxlDiagonalUp

xlInsideHorizontalxlInsideVerticaly为:

xlContinuous

xlDoublexlDashxlDashDotxlDashDotDotxlDot

xlSlantDashDotxlLineStyleNonez为:

xlHairlinexlThinxlMediumxlThick

[a1].Interior.ColorIndex=n[a1].Interior.Pattern=n

[a1].Interior.PatternColorIndex=n[a1].Locked=True/False

[a1].FormulaHidden=True/False

因篇幅问题不能全部显示,请点此查看更多更全内容