Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Excel 中,我有一个包含大量数据的非常大的文档,我正在寻找移动单元格的最佳方法。
我有列A, B,C和D, 我想将它们移到C, D,E和F. 问题是现在它是左对齐的,所以有时单元格中没有任何内容,D所以它将那些应该在单元格中的值D放入C。解决此问题的最佳方法是什么?
A
B
C
D
E
F
有一个图片链接,说明我的意思:
试试这个:
Sub dural() Dim N As Long, L As Long N = Cells(Rows.Count, "A").End(xlUp).Row For L = 1 To N While Cells(L, "F") = "" Cells(L, 1).Insert (xlShiftToRight) Wend Next L End Sub