zoukankan      html  css  js  c++  java
  • vb笔记

    输入窗 mydate = InputBox("请输入日期")
    给单元格赋值 Range("c2") = mydate                     
    消息框 MsgBox ("添加成功")
     
    eles if 实例: '
     Dim mydate
     Dim check
     1: mydate = InputBox("请输入日期")
     check = MsgBox("添加成功", vbYesNo)
     If check = vbYes Then
         Range("c2") = mydate
     Else:
         GoTo 1
     End If
     End Sub
     
    do until 列出所有excel文件 
     Dim myrow As Integer
     Dim myfile As String
     myrow = 1
     myfile = Dir("*.xls*")
     Do Until myfile = ""
         Cells(myrow, 1) = myfile
         myrow = myrow + 1
         myfile = Dir
     Loop
     End Sub
     
    ' selectcase计算星期 Macro Sub selectcase计算星期()
       Dim weeknum As Integer
       Dim mydate As Date
       mydate = CDate(Range("c1"))
       weeknum = Weekday(mydate)
       Select Case weeknum
         Case 1
         MsgBox "星期天"
          Case 2
         MsgBox "星期一"
          Case 3
         MsgBox "星期二"
          Case 4
         MsgBox "星期三"
          Case 5
         MsgBox "星期四"
          Case 6
         MsgBox "星期五"
          Case 7
         MsgBox "星期六"
     Case Else
           MsgBox "计算错误"
         End Select
        
     End Sub
     
    删除批注  Dim ws As Worksheet
         Dim cmt As Comment
         For Each ws In Worksheets
             For Each cmt In ws.Comments
             cmt.Delete
             Next
         Next
     End Sub

  • 相关阅读:
    POJ 3660 Cow Contest——flody求传递闭包
    最小生成树算法
    最短路练习
    UVa 11491 Erasing and Winning
    uva 1610 聚会游戏
    C#操作Excel
    C#操作Excel文件(转)
    sqlserver行列转换问题(网上搜集)
    ASP.NET常用技术之Cookie
    ASP.NET常用技术之加密解密
  • 原文地址:https://www.cnblogs.com/yanweichen/p/9128591.html
Copyright © 2011-2022 走看看