Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Copy changing group of cells from Sheet1 to Sheet2

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copy changing group of cells from Sheet1 to Sheet2

Had my mind on range, needed region. Use this modified version.

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




"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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Copy changing group of cells from Sheet1 to Sheet2

JLGWhiz,

Thanks for the help. I can't wait to get into work to try this. I am
fairly new to Excel and really new at VBA. I have a lot to learn.

This is probably a really dumb question. How do you establish a "Region" in
Sheet1?

Thanks again,

Brad


"JLGWhiz" wrote:

Had my mind on range, needed region. Use this modified version.

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




"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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
Auto Copy from Sheet1 to Sheet2 ryguy7272 Excel Programming 6 January 10th 08 04:23 PM
A1 Sheet2 is linked to A1 sheet1 so that user enters value(abc123) a1 sheet1 and A1 sheet2 is updated pano[_3_] Excel Programming 2 October 28th 07 02:32 PM
List a group of repeated data from sheet1 to sheet2 but not repeat Tasmania New Users to Excel 1 January 26th 07 09:08 PM
Copy result from sheet1 to sheet2 Winnie Excel Discussion (Misc queries) 3 June 26th 06 09:22 AM


All times are GMT +1. The time now is 01:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"