View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Copy changing group of cells from Sheet1 to Sheet2

Create your command button from the Control Toolbox, then in design mode
right click the button and select View Code from the drop down list. Copy
the code below into the code window that opens.

Private Sub CommandButton1_Click()
Sheets(1).ActiveCell.CurrentRange.Copy _
Sheets(2).Range("A1")
Application.CutCopyMode = False
End Sub

Exit design mode, select a cell in the range, then click the button.


"Brad" wrote in message
...
I have a logical group of cells in Sheet1 that can change in size over time
(new cells are added, old cells are removed)

I would like to have a way to copy this group of cells from Sheet1 into
Sheet2 with the push of a button. (Keep in mind that the number of cells
fluctuate)

I am curious if anyone else has ever run into this and if there is a VBA
example of how they handled it.

Thanks in advance for your assistance.

Brad