excel - 循环/复制/粘贴
问题描述
我在下面添加了一段代码到已经存在的代码中,好消息是它可以工作!坏消息是它确实放慢了宏观经济的速度。想知道是否有什么我可以做的不同的事情来让这个运行得更快。
我正在尝试遍历工作簿中的所有工作表,在范围(LastRow x LastColumn)中搜索“X”,如果我想粘贴值“X”的单元格中有“X”。
谢谢!乔什
For Each y In SubAssyArray
Sheets(y).Activate
Set ws = ActiveSheet
Set StartCell = Cells(12, 10) 'Cell J12
LastRow = ws.Cells(ws.Rows.Count, StartCell.Column).End(xlUp).Row
LastColumn = ws.Cells(StartCell.Row, ws.Columns.Count).End(xlToLeft).Column - 3 '-3 columns to not count need date or ECD info
For i = 10 To LastColumn 'Set from which column number you want the loop to start from
For j = 12 To LastRow
If Cells(j, i).Value = "X" Then
Cells(j, i).Copy
Cells(j, i).PasteSpecial xlPasteValues
Else
End If
Next j
Next i
Next y
解决方案
推荐阅读
- node.js - Alexa 音频播放器指令
- reactjs - 如何在反应中隐藏/显示特定组件
- assembly - 如何从字符串输入中删除逗号
- sql - 在 SQL Server 中创建递归函数
- java - 简单的 AsyncTasc - 更好的解决方案 - 防止内存泄漏
- raspberry-pi - 通过 T-Mobile GSM SIM 与 SIM800 板和 SAKIS3G 连接 Raspberry Pi-3
- python - Python TypeError:'int'对象不可迭代,试图将整数附加到列表中
- sql - ColdFusion 不使用 SQL 计算数量
- python - Pycharm 不导入 dlib
- python - TidfVectorizer - TypeError:TypeError:预期的字符串或类似字节的对象