0
https://www.imageupload.co.uk/images/2017/09/25/question.pngVBA複製一定範圍內的值到另一個新的工作簿
請問我怎樣才能讓代碼自動複製從A3數據的範圍 - I19到另一個新的工作簿通過單擊「命令按鈕」。
Sub CommandButton()
Range("A3").Copy Range("I19")
End Sub
https://www.imageupload.co.uk/images/2017/09/25/question.pngVBA複製一定範圍內的值到另一個新的工作簿
請問我怎樣才能讓代碼自動複製從A3數據的範圍 - I19到另一個新的工作簿通過單擊「命令按鈕」。
Sub CommandButton()
Range("A3").Copy Range("I19")
End Sub
指定波紋管命令按鈕。
Sub CommandButton()
Dim wb As Workbook
Set wb = Workbooks.Add(xlWBATWorksheet)
Dim sh As Long
Dim rg As Range
Dim Rng As Range
Dim rw As Range
Application.ScreenUpdating = False
For Each rw In Range("A3:I19").Cells
If rw.EntireRow.Hidden = False Then
If Rng Is Nothing Then Set Rng = rw
Set Rng = Union(rw, Rng)
End If
Next
Rng.Copy
With wb.Sheets("Sheet1")
sh = .Cells(Rows.Count, "A").End(xlUp).row + 2
.Activate
.Cells(sh, "A").Select
End with
ActiveSheet.Paste
End Sub
'End With'丟失。 – AntiDrondert
方面。謝謝。 – mgae2m