#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Cut N Paste

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in the
range (on sheet "test") that I do not want to be included in the cut/paste.

Is there a way to exclude it? For the data, I need to both the values and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Cut N Paste

After pasting, you could delete every button on the myDest sheet by using the
Buttons collection:

For Each b In ThisWorkbook.Worksheets("myDest").Buttons
b.Delete
Next b

Regards
Ben


"Patti" wrote:

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in the
range (on sheet "test") that I do not want to be included in the cut/paste.

Is there a way to exclude it? For the data, I need to both the values and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Cut N Paste

Thanks Ben. But is there anyway to just exclude it from the cut? I need it
to remain on my main page "test" for future use.

Regards,

Patti

"Ben Griffiths" wrote:

After pasting, you could delete every button on the myDest sheet by using the
Buttons collection:

For Each b In ThisWorkbook.Worksheets("myDest").Buttons
b.Delete
Next b

Regards
Ben


"Patti" wrote:

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in the
range (on sheet "test") that I do not want to be included in the cut/paste.

Is there a way to exclude it? For the data, I need to both the values and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cut N Paste

Just to supplement.
If it is in the Buttons collection (and it probably is, because a true
commandbutton isn't copied with the code shown by the OP), then

Thisworkbook.Worksheets("MyDest").Buttons.Delete

should suffice. (save a little looping)

--
Regards,
Tom Ogilvy


"Ben Griffiths" wrote in message
...
After pasting, you could delete every button on the myDest sheet by using

the
Buttons collection:

For Each b In ThisWorkbook.Worksheets("myDest").Buttons
b.Delete
Next b

Regards
Ben


"Patti" wrote:

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in

the
range (on sheet "test") that I do not want to be included in the

cut/paste.

Is there a way to exclude it? For the data, I need to both the values

and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Cut N Paste

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
Dim rng As Range
Set rng1 = Sheets("test").Range("a:o").EntireColumn
rng1.Copy
With Worksheets("MyDest").Range("A1")
.PasteSpecial xlFormats
.PasteSpecial xlFormulas
End With
rng1.ClearContents
End Sub

Works for me.

--
Regards,
Tom Ogilvy


"Patti" wrote in message
...
Thanks Ben. But is there anyway to just exclude it from the cut? I need

it
to remain on my main page "test" for future use.

Regards,

Patti

"Ben Griffiths" wrote:

After pasting, you could delete every button on the myDest sheet by

using the
Buttons collection:

For Each b In ThisWorkbook.Worksheets("myDest").Buttons
b.Delete
Next b

Regards
Ben


"Patti" wrote:

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in

the
range (on sheet "test") that I do not want to be included in the

cut/paste.

Is there a way to exclude it? For the data, I need to both the

values and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Cut N Paste

As always, I appreciate your help Tom!

"Tom Ogilvy" wrote:

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
Dim rng As Range
Set rng1 = Sheets("test").Range("a:o").EntireColumn
rng1.Copy
With Worksheets("MyDest").Range("A1")
.PasteSpecial xlFormats
.PasteSpecial xlFormulas
End With
rng1.ClearContents
End Sub

Works for me.

--
Regards,
Tom Ogilvy


"Patti" wrote in message
...
Thanks Ben. But is there anyway to just exclude it from the cut? I need

it
to remain on my main page "test" for future use.

Regards,

Patti

"Ben Griffiths" wrote:

After pasting, you could delete every button on the myDest sheet by

using the
Buttons collection:

For Each b In ThisWorkbook.Worksheets("myDest").Buttons
b.Delete
Next b

Regards
Ben


"Patti" wrote:

I need to cut data from one sheet and paste it to another. The column
numbers always remain the same, but the number of rows will vary. The
following works, but the problem is that there is a command button in

the
range (on sheet "test") that I do not want to be included in the

cut/paste.

Is there a way to exclude it? For the data, I need to both the

values and
the formatting.

TIA,

Patti

Sub cutNpaste()
' works, but includes command button imbedded on sheet "test"
With Sheets("test")
Range("a:o").EntireColumn.Cut _
Destination:=Sheets("myDest").Range("a1")
End With

End Sub




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
Paste and Paste Special No Longer Working - Excel 2003 SheriJ Excel Discussion (Misc queries) 2 January 15th 09 09:23 PM
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. stan-the-man Excel Worksheet Functions 7 June 14th 06 08:10 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
How do I capture user paste action and convert to Paste Special DonC Excel Programming 0 November 19th 04 01:43 PM
Macro to Paste to specific line, and continue to Paste each time on next row not over tomkarakowski[_2_] Excel Programming 1 May 28th 04 06:50 PM


All times are GMT +1. The time now is 04:10 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"