Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste and Paste Special No Longer Working - Excel 2003 | Excel Discussion (Misc queries) | |||
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. | Excel Worksheet Functions | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
How do I capture user paste action and convert to Paste Special | Excel Programming | |||
Macro to Paste to specific line, and continue to Paste each time on next row not over | Excel Programming |