怎样打开VBA编辑器的工具栏,方便使用功能?

2025-09-28 02:19:12

1、首先在开发工具中打开VBA编辑器

怎样打开VBA编辑器的工具栏,方便使用功能?

2、在单元格区域当中输入一些内容作为例子

怎样打开VBA编辑器的工具栏,方便使用功能?

3、在VBA编辑器中插入模块

怎样打开VBA编辑器的工具栏,方便使用功能?

4、在模块当中输入如下代码,

Sub 填充代码区域空白单元格()

 

Dim i As Long, rng As Range

 

Range("A1:K12000").Activate     '激活一个区域,也可以使用鼠标选择一个区域,然后省了这句

 

'For Each i In Selection

 

  'If i = "SHI" Or i = "线名" Then

 

    'i.Offset(-1).RowHeight = 35

 

    'Cells(1, 11).ColumnWidth = 10

 

    'ActiveWindow.RangeSelection.ColumnWidth = w

 

    'ActiveWindow.RangeSelection.RowHeight = h

 

  'End If

 

'Next

 

For i = 0 To 100

 

    Rows(1 + i * 8).RowHeight = 30

 

    Rows(2 + i * 8).RowHeight = 35

 

    Rows(2 + i * 8).Font.Size = 18

 

    Rows(3 + i * 8).RowHeight = 30

 

    Rows(3 + i * 8).Font.Size = 11

 

    Rows(4 + i * 8).RowHeight = 30

 

    Rows(4 + i * 8).Font.Size = 11

 

    Rows(5 + i * 8).RowHeight = 30

 

    Rows(5 + i * 8).Font.Size = 11

 

    Rows(6 + i * 8).RowHeight = 245

 

    Rows(7 + i * 8).RowHeight = 245

 

    Rows(8 + i * 8).RowHeight = 30

 

    Columns(1).ColumnWidth = 0

 

    Columns(2).ColumnWidth = 6

 

    Columns(3).ColumnWidth = 6

 

    Columns(4).ColumnWidth = 9

 

    Columns(5).ColumnWidth = 9

 

    Columns(6).ColumnWidth = 9

 

    Columns(7).ColumnWidth = 10

 

    Columns(8).ColumnWidth = 10

 

    Columns(9).ColumnWidth = 10

 

    Columns(10).ColumnWidth = 10

 

Range("B" & (2 + i * 8) & ":J" & (2 + i * 8)).Merge

 

    With Range("B" & (2 + i * 8))

 

        .Value = "涵洞设备卡片"

 

        .HorizontalAlignment = xlCenter

 

        .VerticalAlignment = xlCenter

 

        '.Font.Bold = True

 

        .Font.Bold = False

 

        .Font.Name = "黑体"

 

    End With

 

Range("B" & (3 + i * 8) & ":C" & (3 + i * 8)).Merge

 

    With Range("B" & (3 + i * 8))

 

        .Value = "设备编号:"

 

        .HorizontalAlignment = xlCenter

 

        .VerticalAlignment = xlCenter

 

        .Font.Bold = False

 

        .Font.Name = "宋体"

 

    End With

 

    With Range("D" & (3 + i * 8))

 

        .Value = Sheet2.Range("E" & (2 + i)).Value

 

        .HorizontalAlignment = xlCenter

 

        .VerticalAlignment = xlCenter

 

        .Font.Bold = False

 

        .Font.Name = "宋体"

 

    End With

 

    With Range("B" & (4 + i * 8))

 

        .Value = Sheet2.Range("F1").Value

 

        .HorizontalAlignment = xlCenter

 

        .VerticalAlignment = xlCenter

 

        .Font.Bold = False

 

 

怎样打开VBA编辑器的工具栏,方便使用功能?

5、接着我们点击上传功能区当中的视图,然后在列表当中我们点击工具栏,找到编辑工具,点击打开,

怎样打开VBA编辑器的工具栏,方便使用功能?

6、最后在页面右上角的位置,我们就可以看到编辑工具栏了,我们还可以活动来调节编辑工具栏的位置,方便我们使用,

怎样打开VBA编辑器的工具栏,方便使用功能?

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢