小编tan*_*nia的帖子

使用excel VBA激活工作表

我在文件夹中有一个"工作簿A"文件.每两周都会向我发送一个更新版本.我想从另一个工作簿"工作簿B"打开此工作簿,同时删除"工作簿A"中的空白行.

打开和删除操作将通过使用宏发生.

到目前为止,这是我的代码.

Sub RemoveEmptyRows()
    ' this macro will remove all rows that contain no data
    ' ive named 2 variables of data type string
    Dim file_name  As String
    Dim sheet_name As String

    file_name = "C:\Users\Desktop\Workstation_A\Workbook_A.xlsm"
    'Change to whatever file i want
    sheet_name = "Worksheet_A"   'Change to whatever sheet i want

    ' variables "i" and "LastRow" are needed for the for loop
    Dim i As Long
    Dim LastRow As Long

    ' we set wb as a new work book since …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba excel-2013

4
推荐指数
1
解决办法
4154
查看次数

标签 统计

excel ×1

excel-2013 ×1

excel-vba ×1

vba ×1