出於某種原因,我無法弄清楚如何做到這一點......它似乎很簡單:開始在特定的行刪除不需要的列 - Excel VBA中
試圖刪除其起始於特定行不需要的列。
例如: 想要刪除從Wsh2的第10行開始的列C,D,E,M,N和L.
'deleting columns that are unwanted
Cells(wsh2.Cells("C10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
Cells(wsh2.Cells("D10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
Cells(wsh2.Cells("E10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
Cells(wsh2.Cells("M10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
Cells(wsh2.Cells("N10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
Cells(wsh2.Cells("L10"), wsh2.Cells("C10").End(xlDown)).EntireColumn.Delete
End Sub
我調整了我在這裏找到的使用Range的前面的代碼。我也試圖使用聯盟和範圍,但似乎無法弄清楚。
基本上:在我從之前的工作表中複製了一系列行後,試圖刪除從特定行開始的特定列。
任何幫助將是偉大的。謝謝!
因此,您不是要刪除整列,而只是清除第10行及以下的數據? – Busse
清除第10行和第10行以下的數據,然後我想隱藏已清除的列,以便它不顯示已清除的列與數據保存的列之間的間隔 – MAJ10
行1中是否仍有數據 - 9?如果你隱藏了列,你也會忽略這些數據。 – Busse