excel - 嵌套 for 循环重复结果
问题描述
所以我试图将多张纸上的数据复制到一张纸上。我遇到的问题是它重复了一张适合 IF 语句的结果 5 次(因为我有 5 张纸)。这将如何在 VBA 中解决?
Dim Current As Worksheet
Dim j As Integer
Dim Target As Worksheet
Set Target = ActiveWorkbook.Worksheets("CopyToThis")
j = 1 ' Start copying to row 1 in target sheet
For Each Current In Worksheets
For Each c In Current.Range("I:I")
If c > 0 Then
MsgBox (Current.Name)
Current.Rows(c.Row).Columns("A:F").Copy Target.Rows(j) 'Copy only columns A to F
j = j + 1
End If
Next c
Next
解决方案
推荐阅读
- arrays - Powershell循环通过事件日志
- mysql - SQL Union all throws SQL Syntax error 但两个 SELECTS 都可以
- windows - 创建最新文件版本的副本,并在 windows 批处理文件中将文件名中的版本增加一个
- firefox - svg 噪声未在 Firefox 中显示
- python - 关闭第二个 Tkinter 窗口不起作用
- c# - 使用自定义 Outlook Web App 插件设置电子邮件的类别
- php - 使用 select 和 with 时 Lumen/Laravel 获取属性
- r - R中顺序计算步骤的向量化
- c++ - 当映射包含字符串向量作为值时从值中获取键的有效方法
- objective-c - C函数中可以有两种返回类型吗?