使用VBA批量CSV转XLS(97-2003)
Sub EditCsvToXls()
Application.ScreenUpdating = False
'文件目录
ChDir "C:\Users\QA-Department\Desktop\test"
Dim sDir As String
Dim curdir As String
curdir = "C:\Users\QA-Department\Desktop\test"
sDir = Dir(curdir & "\*.csv")
While Len(sDir)
Workbooks.Open Filename:=curdir & "\" & sDir
'删除一些段落
Rows("1:7").Select
Selection.Delete Shift:=xlUp
Rows("193:197").Select
Selection.Delete Shift:=xlUp
Rows("373:377").Select
Selection.Delete Shift:=xlUp
Rows("618:618").Select
Selection.Delete Shift:=xlUp
Range("A1").Value = "???(MHz)"
Range("B1").Value = "???(dB)"
Columns("A:C").Select
Columns("A:C").EntireColumn.AutoFit
'损耗设置为正值
For i = To
Range("B" & i).Value = Range("B" & i) * -
Next i
'重命名表名
Sheets().Name = "sheet1"
Range("B2:B617").Select
'有效数字
Selection.NumberFormatLocal = "0.00"
Range("A1").Select Dim temp As String
temp = Left(sDir, Len(sDir) - )
ActiveWorkbook.SaveAs Filename:=curdir & "\" & temp & ".xls", _
FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
sDir = Dir
Wend
Application.ScreenUpdating = True
End Sub
使用VBA批量CSV转XLS(97-2003)的更多相关文章
- 用NPOI实现导入导出csv、xls、xlsx数据功能
用NPOI实现导入导出csv.xls.xlsx数据功能 直接上代码 首先定义一个接口 如果需要直接操作文件的话,就自己在封装一次 然后定义csv类的具体实现 这个需要引入命名空间LumenWo ...
- .csv 和 .xls 的区别
.csv 和 .xls 的区别 .csv .xls 较为通用,易导入至各式表格.资料库等 Microsoft excel的专用档案 文本档案,用记事本就可以打开 二进位档案,只有用excel才能打开 ...
- 使用VBA批量转换Excel格式,由.xls转换成.xlsx
问题分析: Excel2007以前的格式是.xls,之后的格式是.xlsx.打开单独的一个Excel文档,使用“另存为”功能,可以很轻松的转换格式.但是面对几百个Excel表这样就太累了,搜索很久,也 ...
- 关于使用宏将csv批量转换成xls的分享
最近在使用遇到一个问题需要把csv格式的文件转成xls,随便新建一个excel,然后打开,选择“开发工具”,找到下图“宏”,如果跟下图一样的话就需要先启用宏,启用之后可以直接把下面的代码直接复制到代码 ...
- excel导入导出的两种方式:csv和XLS
依赖 <dependency> <groupId>net.sourceforge.jexcelapi</groupId> <artifactId>jxl ...
- R语言学习——R读取txt、csv、xls和xlsx格式文件
最近项目中运用到了R读取文件数据,所以把相关好用的.经过验证的方法总结了一下,有效避免下次入坑. 1. R读取txt文件 使用R读取txt文件直接使用read.table()方法进行读取即可,不需要加 ...
- Excel VBA批量处理寸照名字
需求:因为处理学生学籍照片,从照相馆拿回来的寸照是按班级整理好,文件名是相机编号的文件.那么处理的话,是这么一个思路,通过Excel表格打印出各班A4照片列表,让学生自行填上照片对应姓名.表格收回来后 ...
- C#读取csv、xls、sql数据库的实现
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Secu ...
- golang csv,xls,xlsx
要用到的包: "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform ...
随机推荐
- Java-IO流之BufferedReader 和BufferedWriter的使用和原理
BufferedReader和BufferedWriter出现的目的是为了对FileReader以及FileWriter的读写操作进行增强,而怎么增强呢,原理类似于使用StringBuilder,是把 ...
- pycharm 中 django 导入静态文件不提示补全
File—>setting----->Languages & Frameworks ------> Python Template Languages ------> ...
- spring boot 集成 Redis
前提:你已经安装了Redis 1.创建一个spring boot 工程 2.pom 引入依赖:spring-boot-starter-data-redis <dependency> < ...
- nova file injection的原理和调试过程
file injection代码 file injection原理来讲是比较简单的,在nova boot命令中,有参数--file,是将文件inject到image中 nova boot --flav ...
- [Swift]LeetCode165. 比较版本号 | Compare Version Numbers
Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 &l ...
- [Swift]LeetCode253.会议室 II $ Meeting Rooms II
Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si ...
- [Swift]LeetCode894. 所有可能的满二叉树 | All Possible Full Binary Trees
A full binary tree is a binary tree where each node has exactly 0 or 2 children. Return a list of al ...
- [Swift]LeetCode1006. 笨阶乘 | Clumsy Factorial
Normally, the factorial of a positive integer n is the product of all positive integers less than or ...
- MyBatis增、删、改、查
1.config.xml文件的基本配置信息 2.选择数据源 3.mybatis约定 (1)parameterType和resultType 只能传一个参数,但是我们可以传一个数组或者集合,达到传多个参 ...
- Identity Server 4 中文文档(v1.0.0) 目录
欢迎来到IdentityServer4 第一部分 简介 第1章 背景 第2章 术语 第3章 支持和规范 第4章 打包和构建 第5章 支持和咨询选项 第6章 演示服务器和测试 第7章 贡献 第二部分 快 ...