excel中如何用公式來截取資料?

excel中如何用公式來截取資料?

我使用 MS Excel 2007

我想在工作表 1 中剪下一行,然後使用 excel 中的公式將其貼到工作表 2 我已經使用過 =VLOOKUP 或 =A1 但它只是複製資料而不是剪下它

感謝你的幫助

答案1

您無法在公式中執行此操作,但可以在 VBA 中執行此操作。大致如下:

Sub cut()

Set sh1 = Sheets("Sheet1") 'change your sheet names if they are different
Set sh2 = Sheets("Sheet2")
sh1.Range("A1:H1").cut sh2.Range("A1:H1") 'Select the range you are cutting from and where it being pasted

End Sub

如果您要剪切整行,您也可以使用 .EntireRow。

Sub cut()

Set sh1 = Sheets("Sheet1") 'change your sheet names if they are different
Set sh2 = Sheets("Sheet2")
sh1.Range("A1").EntireRow.cut sh2.Range("A1")


End Sub

看看這個關聯關於如何使用 .cut 方法。

相關內容