VBA:考场场标打印
Function pda(x)
a = x
If Len(a) = 1 Then
ab = "00" & a
ElseIf Len(a) = 2 Then
ab = "0" & a
Else
ab = a End If
pda = ab
End Function
Sub yy()
Worksheets.Select
With ActiveSheet.PageSetup .LeftMargin = Application.CentimetersToPoints(0.5) .RightMargin = Application.CentimetersToPoints(0.5) .TopMargin = Application.CentimetersToPoints(2.5) '顶边距
.Orientation = xlLandscape '纵向 xlPortait横向 .BottomMargin = Application.CentimetersToPoints(1) '底 .HeaderMargin = Application.CentimetersToPoints(0.5) '页眉 .FooterMargin = Application.CentimetersToPoints(0.5) '页脚 .Zoom = 100 End With
End Sub
Sub yya()
For Each sh In ThisWorkbook.Sheets With sh
With .PageSetup
.TopMargin = Application.CentimetersToPoints(2.5) '顶边距 .CenterHorizontally = True '水平居中
.CenterVertically = True '垂直居中
.Orientation = xlLandscape '横向打印 End With
End With
Next
End Sub
Public Sub shanchu()
Application.DisplayAlerts = False '关闭警告信息显示
Dim i As Integer For i = Sheets.Count To 1 Step -1
Debug.Print Sheets(i).Name
If Sheets(i).Name <> "Sheet1" Then
Sheets(i).Delete
End If
Next
End Sub
Sub pd()
n = Worksheets.Count
Dim i As Integer
Dim xx As Integer
Dim yy As Integer
Dim mm As Integer
Rem xx为每个考场的人数
Rem yy为当前专业标记
Rem mm为当前专业考生人数
Rem shu为当前专业考号张数
Rem shuu为当前专业考场数量
xx = 45
yy = 2002
mm = 889
If Int(mm / xx) = mm / xx Then
shuu = mm / xx
ElseIf Int(mm / xx) <> mm / xx Then
shuu = Int(mm / xx) + 1
End If
If Int(mm / xx) = mm / xx Then
shu = mm / xx
ElseIf Int(mm / xx) <> mm / xx Then
shu = Int(mm / xx) + 1
End If For i = 1 To shuu
Sheets.Add after:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "机" & i Next
If yy = 2007 Then
mc = "裴竞考场"
ElseIf yy = 2001 Then
mc = "机电考场"
ElseIf yy = 2002 Then
mc = "计算机考场"
ElseIf yy = 2003 Then
mc = "会计考场"
ElseIf yy = 2004 Then
mc = "学前考场"
ElseIf yy = 2005 Then
mc = "电商考场"
ElseIf yy = 2006 Then
mc = "汽修考场"
ElseIf yy = 2008 Then
mc = "航空考场"
ElseIf yy = 2009 Then
mc = "轨道考场"
ElseIf yy = 2010 Then
mc = "电力考场"
End If bz = 0
For i = 1 To shuu
Worksheets(i).Activate ab = pda((i * xx - xx) + 1) ab1 = pda((i * xx))
If ab1 >= mm Then
If i = shuu Then
ab1 = mm
End If
End If Rows("1:1").RowHeight = 171.75
Rows("2:2").RowHeight = 123.75
Columns("A:A").ColumnWidth = 130.5
Range("A1:c10").Font.Name = "宋体"
Range("A1:c10").Font.Bold = True
Range("A1:A1").Font.Size = 90
Range("A2:A2").Font.Size = 60
Range("A1:a2").HorizontalAlignment = xlCenter
If i = shuu And i = 1 Then Range("a" & 1) = mc Else
Range("a" & 1) = mc & i
End If
abb = ab
Range("a" & 2) = "(" & yy & ab & " - " & yy & ab1 & ")" Next
For Each sh In ThisWorkbook.Sheets With sh
With .PageSetup
.TopMargin = Application.CentimetersToPoints(2.5) '顶边距 .CenterHorizontally = True '水平居中
.CenterVertically = True '垂直居中
.Orientation = xlLandscape '横向打印 End With
End With
Next
End Sub
Sub pdda()
n = Worksheets.Count
Dim i As Integer
Dim xx As Integer
Dim yy As Integer
Dim mm As Integer
Rem xx为每个考场的人数
Rem yy为当前专业标记
Rem mm为当前专业考生人数
Rem shu为当前专业考号张数
Rem shuu为当前专业考场数量
xx = 45
yy = 2002
mm = 889
If Int(mm / xx) = mm / xx Then
shuu = mm / xx
ElseIf Int(mm / xx) <> mm / xx Then
shuu = Int(mm / xx) + 1
End If
If Int(mm / xx) = mm / xx Then
shu = mm / xx
ElseIf Int(mm / xx) <> mm / xx Then
shu = Int(mm / xx) + 1
End If For i = 1 To shuu
Sheets.Add after:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "计" & i Next
If yy = 2007 Then
mc = "裴竞考场"
ElseIf yy = 2001 Then
mc = "机电考场"
ElseIf yy = 2002 Then
mc = "计算机考场"
ElseIf yy = 2003 Then
mc = "会计考场"
ElseIf yy = 2004 Then
mc = "学前考场"
ElseIf yy = 2005 Then
mc = "电商考场"
ElseIf yy = 2006 Then
mc = "汽修考场"
ElseIf yy = 2008 Then
mc = "航空考场"
ElseIf yy = 2009 Then
mc = "轨道考场"
ElseIf yy = 2010 Then
mc = "电力考场"
End If bz = 0
For i = 2 To shuu
Worksheets(i).Activate ab = pda((i * xx - xx) + 1) ab1 = pda((i * xx))
If ab1 >= mm Then
If i = shuu Then
ab1 = mm
End If
End If Rows("1:1").RowHeight = 171.75
Rows("2:2").RowHeight = 123.75
Columns("A:A").ColumnWidth = 130.5
Range("A1:c10").Font.Name = "宋体"
Range("A1:c10").Font.Bold = True
Range("A1:A1").Font.Size = 90
Range("A2:A2").Font.Size = 60
Range("A1:a2").HorizontalAlignment = xlCenter
If i = shuu And i = 1 Then Range("a" & 1) = mc Else
Range("a" & 1) = mc & i
End If
abb = ab
Range("a" & 2) = "(" & yy & ab & " - " & yy & ab1 & ")"
With ActiveSheet.PageSetup
.TopMargin = Application.CentimetersToPoints(2.5) '顶边距
.CenterHorizontally = True '水平居中
.CenterVertically = True '垂直居中
.Orientation = xlLandscape '横向打印 End With
Next End Sub
VBA:考场场标打印的更多相关文章
- EXCEL:宏 考场考号打印
Sub addwork() Rem 当前宏是根据学生数量 .每考场人数计算工作表数Dim i As IntegerRem xx为每个考场的人数Rem yy为当前专业标记Rem mm为当前专业考生人数R ...
- 利用vba实现excel表格连接打印编号(一页两个编号),编号支持前缀
先看一下excel文件, 下图左边部分为文件签审单为要打印的内容, 要求一页需要打印两个文件签审单, NO需要根据打印页面连续编号, 右边部分为打印设置,以及vba部分代码展示, 打印设置可以设置打印 ...
- tshark----wireshark的命令行工具
tshark - 转储和分析网络流 概要 tshark的 [ -2 ] [ -a <捕捉自动停止条件>] ... [ -b <捕捉环形缓冲区选项>] ... [ ...
- Go语言基础知识总结(持续中)
Go基础知识总结 变量声明 Go语言中的变量需要声明以后才可以使用(需要提前定义变量)并且声明后必须使用(不适用会报错) 标准声明 var 变量名 变量类型 example: var name str ...
- excel vba 打印设置(转)
FROM: http://hi.baidu.com/kdlipm/blog/item/0897dd16ffc03e59f3de32ab.html PageSetup 函式就會記錄時, 設定的記錄三個部 ...
- VBA 打印设置相关属性及方法
打印设置说明,以下均为默认值. With ActiveSheet.PageSetup .PrintTitleRows = "" '工作表打印标题:顶端标题行(R) .PrintTi ...
- VBA 打印及破密
Sub 打印()ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=TrueCall dyEnd SubSub dy()Dim a%, b ...
- VBA Excel 打印
1. 设置 页边距.打印区域 With .PageSetup .HeaderMargin = Application.CentimetersToPoints(0.5) .LeftMargin = Ap ...
- PACM Team(牛客第三场多校赛+dp+卡内存+打印路径)
题目链接(貌似未报名的不能进去):https://www.nowcoder.com/acm/contest/141/A 题目: 题意:背包题意,并打印路径. 思路:正常背包思路,不过五维的dp很容易爆 ...
随机推荐
- MongoDB学习笔记:Python 操作MongoDB
MongoDB学习笔记:Python 操作MongoDB Pymongo 安装 安装pymongopip install pymongoPyMongo是驱动程序,使python程序能够使用Mong ...
- harbor搭建及使用
harbor搭建及使用 1 系统及软件版本 1.1 系统版本 # uname -a Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP ...
- 分层条件关系网络在视频问答VideoQA中的应用:CVPR2020论文解析
分层条件关系网络在视频问答VideoQA中的应用:CVPR2020论文解析 Hierarchical Conditional Relation Networks for Video Question ...
- Imec推出高性能芯片的低成本冷却解决方案
Imec推出高性能芯片的低成本冷却解决方案 Imec unveils low-cost cooling solution for high-performance chips 3D打印冷却器优于传统解 ...
- 尚硅谷Java——宋红康笔记【day19-day24】
day19 测试Thread中的常用方法: start():启动当前线程:调用当前线程的run() run(): 通常需要重写Thread类中的此方法,将创建的线程要执行的操作声明在此方法中 curr ...
- Qt中的内存回收机制
Qt中的内存回收机制 在Qt中创建对象的时候会提供一个 Parent对象指针(可以查看类的构造函数),下面来解释这个parent到底是干什么的. QObject是以对象树的形式组织起来的.当你创建一个 ...
- 停车场事故频频,AI 达人将摄像头变身安全卫士
2021 年 2 月,"新内容 新交互" 全球视频云创新挑战赛启幕.本次大赛由英特尔联合阿里云主办,与优酷战略技术合作,天池平台和阿里云视频云团队共同承办.大赛自开赛以来,吸引了全 ...
- 【NX二次开发】Block UI 双精度表
属性说明 常规 类型 描述 BlockID String 控件ID Enable Logical 是否可操作 Group Logical ...
- v-for和v-if不能同时使用
如果使用v-for遍历数据时,想筛选出URL不为空的项并进行渲染 <ul> <li v-for="(item,index) in list" v-if=" ...
- 有了Java8的“+”真的可以不要StringBuilder了吗
最近在头条上看到一篇帖子,说Java8开始,字符串拼接时,"+"会被编译成StringBuilder,所以,字符串的连接操作不用再考虑效率问题了,事实真的是这样吗?要搞明白,还是要 ...