大家好,又见面了,我是你们的朋友全栈君。
‘AddOne
‘AddNew
‘FourthOne
Worksheets(“Sheet2”).Activate
‘SeveralRows
‘ClearRange
‘SetValue
‘EnterValue
CycleThrough
End Sub
Sub AddOne()
Workbooks.Add
End Sub
Sub AddNew()
Set newBook = Workbooks.Add
With newBook
.Title = “1995 Sales”
.Subject = “Sales”
.SaveAs Filename:=”95Sales.xls”
End With
End Sub
Sub FourthOne()
‘AddOne
‘Sheets(3).Activate
‘Charts(1).Activate
‘Charts(“Chart1”).Activate
‘ActiveWorkbook.SaveAs _
‘Filename:=”E:/myfile.htm”, _
‘FileFormat:=xlHtml
‘ChartObjects(1).Activate
‘With Application.DefaultWebOptions
‘.RelyOnVML = True
‘.AllowPNG = True
‘.PixelsPerInch = 96
‘End With
‘With ActiveWorkbook
‘.WebOptions.AllowPNG = False
‘With .PublishObjects(“Chart3”)
‘.Filename = “E:/1998_Q1.htm”
‘.Publish
‘End With
‘End With
End Sub
Sub SeveralRows()
Worksheets(“Sheet2”).Activate
Dim worksheettemp As Worksheet
Set worksheettemp = Worksheets(“Sheet2”)
Dim myUnion As Range
Set myUnion = Union(worksheettemp.Rows(1), worksheettemp.Rows(2), worksheettemp.Rows(5))
myUnion.Font.Bold = True
End Sub
Sub ClearRange()
Worksheets(“Sheet2”).[A1:B5].ClearContents
End Sub
Sub SetValue()
Dim MyRange As Range
Set MyRange = Worksheets(“Sheet2”).[A1:B5]
MyRange.Value = 10
End Sub
Sub EnterValue()
Worksheets(“Sheet2”).Cells(6, 1).Value = 10
End Sub
Sub CycleThrough()
Dim counter As Integer
For counter = 1 To 20
Worksheets(“Sheet2”).Cells(counter, 3).Value = counter
Next counter
End Sub
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/141734.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...