ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code to copy a range of cells to another sheet (https://www.excelbanter.com/excel-programming/357787-code-copy-range-cells-another-sheet.html)

Robb27

code to copy a range of cells to another sheet
 
I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob

Toppers

code to copy a range of cells to another sheet
 
Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Robb27

code to copy a range of cells to another sheet
 
Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Toppers

code to copy a range of cells to another sheet
 
Hi,
Look at Ron de Bruin's site which has an add-in for E-mailing
workbooks/worksheets.

http://www.rondebruin.nl/mail/add-in.htm

HTH

"Robb27" wrote:

Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Robb27

code to copy a range of cells to another sheet
 
Thanks for your response Toppers. One more question please.
How do you undo what my first question was if I uncheck the box?

Robb

"Toppers" wrote:

Hi,
Look at Ron de Bruin's site which has an add-in for E-mailing
workbooks/worksheets.

http://www.rondebruin.nl/mail/add-in.htm

HTH

"Robb27" wrote:

Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Toppers

code to copy a range of cells to another sheet
 
Robb,
What do you mean by "undo" (what my first question was )?
Like this ?

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
Else ' not clicked ....
' Whatever "undo" means .........
End If
End Sub

"Robb27" wrote:

Thanks for your response Toppers. One more question please.
How do you undo what my first question was if I uncheck the box?

Robb

"Toppers" wrote:

Hi,
Look at Ron de Bruin's site which has an add-in for E-mailing
workbooks/worksheets.

http://www.rondebruin.nl/mail/add-in.htm

HTH

"Robb27" wrote:

Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Robb27

code to copy a range of cells to another sheet
 
Toppers,

Well, I mean:
When you check the box (my original post) it copies the row to another
sheet. What if I uncheck the box? - I want to row that was copied to the
other sheet to go away. Basically "undoing" the initial process of checking
the box. I appreciate your help.

Robb

"Toppers" wrote:

Robb,
What do you mean by "undo" (what my first question was )?
Like this ?

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
Else ' not clicked ....
' Whatever "undo" means .........
End If
End Sub

"Robb27" wrote:

Thanks for your response Toppers. One more question please.
How do you undo what my first question was if I uncheck the box?

Robb

"Toppers" wrote:

Hi,
Look at Ron de Bruin's site which has an add-in for E-mailing
workbooks/worksheets.

http://www.rondebruin.nl/mail/add-in.htm

HTH

"Robb27" wrote:

Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob


Toppers

code to copy a range of cells to another sheet
 
Based the example below, C1:C10 are copied to G1:G10.

When unchecked, G1:G10 are set to blank.

I don't what range you copied so you need to adjust the RESIZE parameter to
reflect ROWS and COLUMNS copied i.e Resize(rows, columns).

HTH

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
Else ' not clicked ....
Worksheets("Sheet2").Range("G1").Resize(10, 1) = " "
End If
End Sub

"Robb27" wrote:

Toppers,

Well, I mean:
When you check the box (my original post) it copies the row to another
sheet. What if I uncheck the box? - I want to row that was copied to the
other sheet to go away. Basically "undoing" the initial process of checking
the box. I appreciate your help.

Robb

"Toppers" wrote:

Robb,
What do you mean by "undo" (what my first question was )?
Like this ?

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
Else ' not clicked ....
' Whatever "undo" means .........
End If
End Sub

"Robb27" wrote:

Thanks for your response Toppers. One more question please.
How do you undo what my first question was if I uncheck the box?

Robb

"Toppers" wrote:

Hi,
Look at Ron de Bruin's site which has an add-in for E-mailing
workbooks/worksheets.

http://www.rondebruin.nl/mail/add-in.htm

HTH

"Robb27" wrote:

Toppers,

It worked! (of course it did)
Many thanks!

Now, If you could give me one more that would allow a user to click a radio
button and email a just a particular sheet...not the entire workbook, that
would be cool!
Thanks again for your valuable time.

"Toppers" wrote:

Rob,

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Worksheets("Sheet1").Range("C1:C10").Copy Worksheets("Sheet2").Range("G1")
End If
End Sub

HTH

"Robb27" wrote:

I made a checkbox but I need to know how to make it when checked, it will
copy a range of cells to another sheet in the same workbook. Can anyone give
me a sample to get me started? Thanks in advance.

Rob



All times are GMT +1. The time now is 05:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com