BBS

  • 注册
  • 登录
  • 搜索
  • 标签
  • 帮助
BBS » 电脑、手机、平板知识专栏 » 应坛友水若善的需求,给大家一段VBA程序,判断是哪个帖子的代码 » 发表回复

预览帖子

游客


发表回复

用户名 游客 [会员登录]
  (可选)
  • Html 代码 可用
  • 表情 可用
  • Discuz!代码 可用
  • [img] 代码 可用
B I U | 字体 大小
| Align Left Align Center Align Right | Url Email Image | Quote Code
Rremove Format Unlink Undo Redo | Ordered List Unordered List Outdent Indent Float Left Float Right | Table Free Hide | flyflashmp3mtvmusicmusic2
flvmtv2music3
简单功能
  • 仿宋_GB2312
  • 黑体
  • 楷体_GB2312
  • 宋体
  • 新宋体
  • 微软雅黑
  • Trebuchet MS
  • Tahoma
  • Arial
  • Impact
  • Verdana
  • Times New Roman
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
收缩编辑框扩展编辑框
上传附件 描述
文件尺寸: 小于 25000 kb
  [完成后可按 Ctrl+Enter 发布]    恢复数据

主题回顾

zhendeaini 发表于 2015-9-8 10:39

代码如下:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
If Sheet1.[L1] <> 0 Then
Sheet1.[A2].Select
Dim I, J, K As Integer
Dim rowcount As Integer
Dim rowblank As Integer
rowcount = Sheet1.[H1]
rowblank = Sheet1.[F1]
For I = 1 To rowcount
K = 2 + (rowblank + 1) * (I - 1)
  For J = 1 To rowblank
    Rows(K).Select
Selection.Insert Shift:=xlDown, copyorigin:=xlFormatFromLeftOrAbove
Next J
Next I
Sheet1.[J1] = I - 1
Sheet1.[L1] = Sheet1.[H1] - Sheet1.[J1]
Else
MsgBox "您好,您已经执行了" & Sheet1.[J1] & "次,剩余执行次数为:" & Sheet1.[L1] & "次,请确认!"
End If
Application.ScreenUpdating = True
End Sub

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Call 删除行
Sheet1.[A2].Select
Sheet1.[J1] = 0
Sheet1.[L1] = Sheet1.[H1] - Sheet1.[J1]
Application.ScreenUpdating = True
End Sub

Private Sub Workbook_Open()
Sheet1.[A2].Select
Sheet1.[J1] = 0
Sheet1.[L1] = Sheet1.[H1]
End Sub


Sub 删除行()
'
' 删除行 Macro
' 宏由 zhendeaini 录制,时间: 2015-8-11
'
'
    'ActiveCell.Offset(-4, 0).Range("A1:B1").Select
    Columns("A:B").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    Selection.EntireRow.Delete
End Sub

帖子范围:搜索我近期发布的帖子。

当前时区 GMT+8, 现在时间是 2026-4-4 03:41

清除 Cookies - 联系我们 - BBS - WAP - TOP - 界面风格

  • 默认风格
  • 喝彩奥运
  • 深邃永恒
  • 粉妆精灵
  • 诗意田园
  • 春意盎然
  • 黑色

Discuz!

Powered by Discuz! 6.0.0 © 2001-2007 Comsenz Inc.

Processed in 0.048834 second(s), 5 queries, Gzip enabled.