VBA学习第四课

Posted yigeduanpian

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VBA学习第四课相关的知识,希望对你有一定的参考价值。

Sub ss()

Dim biao As Worksheet

Excel.Application.DisplayAlerts = False
For Each biao In Sheets
    If biao.Name <> "绝不能删" Then
    biao.Delete
    End If
    

Next

Excel.Application.DisplayAlerts = True

End Sub

  

Sub xinjian()

Dim sht As Worksheet
For Each sht In Sheets

    sht.Copy

    ActiveWorkbook.SaveAs Filename:="d:data" & sht.Name & ""
    ActiveWorkbook.Close


Next


End Sub

  

Sub test()
Dim i As Integer
Dim sht As Worksheet

For Each sht In Worksheets
    sht.Select
    For i = 100 To 2 Step -1
        ‘处理性别的代码
        If Range("e" & i) = "男" Then
            Range("f" & i) = "先生"
        Else
            Range("f" & i) = "女士"
        End If
        
        ‘处理专业代号
        If Range("b" & i) = "理工" Then
            Range("c" & i) = "LG"
        ElseIf Range("b" & i) = "文科" Then
            Range("c" & i) = "WK"
        Else
            Range("c" & i) = "CJ"
        End If
            
        ‘删除空行
        If Range("d" & i) = "" Then
            Range("D" & i).Select
            Selection.EntireRow.Delete
        End If
    Next
    
    ‘拆分表
    sht.Copy
    ActiveWorkbook.SaveAs Filename:="d:data" & sht.Name & ".xlsx"
    ActiveWorkbook.Close
    
Next

End Sub

  

以上是关于VBA学习第四课的主要内容,如果未能解决你的问题,请参考以下文章

Python 基础 2022 最新第四课 基础语法

法语学习笔记--第四课(家庭)

Python 基础 2022 最新第四课 基础语法

javascript学习第四课函数

python 爬虫学习第四课

python 爬虫学习第四课