excel - 我想将非空白单元格和相应的标题复制到所需目的地的另一张纸上
问题描述
从下面提到的代码中,我需要一个类似output
选项卡的输出:
Sub Macro1()
Dim rngMyCell As Range
Dim wsInputTab As Worksheet
Dim wsOutputTab As Worksheet
Application.ScreenUpdating = False
Set wsInputTab = Sheets("Input") 'Name of input sheet. Change to suit if necessary.
Set wsOutputTab = Sheets("Output") 'Name of output sheet. Change to suit if necessary.
For Each rngMyCell In wsInputTab.Range("A3:A" & wsInputTab.Cells(Rows.Count, "A").End(xlUp).Row)
If IsError(rngMyCell) = False Then
If Len(rngMyCell) > 0 Then
wsOutputTab.Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = rngMyCell
End If
End If
Next rngMyCell
Set wsInputTab = Nothing
Set wsOutputTab = Nothing
Application.ScreenUpdating = True
MsgBox "Done."
End Sub
解决方案
推荐阅读
- python - 如何在点击游戏程序中添加计时器
- vue.js - 带有 axios 的 Vue js - 意外行为
- css - 为什么canva的透明图片不会显示在我的网站上?
- javascript - 计算表中超链接的数量
- java - HTTP 状态 404 -> 请求的资源不可用
- c - C语言中的加载库
- javascript - firestore.where() 同时在两个字段上
- android - 通过 TabLayout 向 ViewPager 传输数据(适配器:FragmentPagerAdapter)
- c# - 对 Xamarin.Mac 的 gRPC 支持
- javascript - Sinon 在 stubbing 之后调用原始方法