Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selection.copy is getting nixed



Next

ActiveWorkbook.Unprotect ("xxx")
Sheets("ws4").Visible = True
Sheets("ws4").Select
.DisplayPageBreaks = False
Sheets("ws4").Range("a2:m21").Select
Selection.copy
Sheets("ws4").Visible = False
ActiveWorkbook.Protect ("xxx")
Sheets("Sheet2").Select


End With
Next

With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With


If you can't tell, I want to select and copy a2:m21 on sheet ws1 (which
is hidden). Then, what I do is have a seperate workbook with a
PasteSpecial - values macro to place this info into a data sheet for
use with a PivotTable.

After the code above executes, what was selected no longer appears on
the clipboard. Ideas?


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=379486

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default selection.copy is getting nixed

I think code clears the clipboard - not sure...

But you can do it easier without selection

Workbooks("PasteTo").Sheets("Sheet2").Range("a2:m2 1").Value = _
Workbooks("PasteFrom").Sheets("ws4").Range("a2:m21 ").Value

just rememer that when transfering values - the 2 ranges must be the same
size.
--
steveB

Remove "AYN" from email to respond
"BigDave" wrote in
message ...


Next

ActiveWorkbook.Unprotect ("xxx")
Sheets("ws4").Visible = True
Sheets("ws4").Select
.DisplayPageBreaks = False
Sheets("ws4").Range("a2:m21").Select
Selection.copy
Sheets("ws4").Visible = False
ActiveWorkbook.Protect ("xxx")
Sheets("Sheet2").Select


End With
Next

With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With


If you can't tell, I want to select and copy a2:m21 on sheet ws1 (which
is hidden). Then, what I do is have a seperate workbook with a
PasteSpecial - values macro to place this info into a data sheet for
use with a PivotTable.

After the code above executes, what was selected no longer appears on
the clipboard. Ideas?


--
BigDave
------------------------------------------------------------------------
BigDave's Profile:
http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=379486



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default selection.copy is getting nixed

Macro execution nixes the undo and the clip board. You need to process the
whole thing in onw fell swoop, not in two seperate macros. domething similar
to this (untested as my computer is tied up)...

sub CopyData()
dim wbkCopyForm as workbook
dim wbkCopyTo as workbook
dim rngCopyFrom as Range
dim rngcopyTo as Range

set wbkCopyFrom = thisworkbook
set wbkCopyTo = workbook.open ("C:\Mybook.xls")
set rngCopyfrom = wbkCopyFrom.Sheets("ws4").Range("A2:M21")
set rngCopyto = wbkCopyTo.Sheets("Sheet1").Range("A65535").end(xlU p)

rngcopyfrom.copy rngcopyto

wbkcopyto.close
end sub
--
HTH...

Jim Thomlinson


"BigDave" wrote:



Next

ActiveWorkbook.Unprotect ("xxx")
Sheets("ws4").Visible = True
Sheets("ws4").Select
.DisplayPageBreaks = False
Sheets("ws4").Range("a2:m21").Select
Selection.copy
Sheets("ws4").Visible = False
ActiveWorkbook.Protect ("xxx")
Sheets("Sheet2").Select


End With
Next

With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With


If you can't tell, I want to select and copy a2:m21 on sheet ws1 (which
is hidden). Then, what I do is have a seperate workbook with a
PasteSpecial - values macro to place this info into a data sheet for
use with a PivotTable.

After the code above executes, what was selected no longer appears on
the clipboard. Ideas?


--
BigDave
------------------------------------------------------------------------
BigDave's Profile: http://www.excelforum.com/member.php...fo&userid=7741
View this thread: http://www.excelforum.com/showthread...hreadid=379486


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 Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
How to 'copy' a drop down box selection? Joni Excel Discussion (Misc queries) 5 June 30th 06 08:30 AM
Copy Selection jackle Excel Discussion (Misc queries) 3 March 7th 06 08:11 PM
copy sum selection Andrew Excel Programming 8 January 17th 05 01:19 AM
row selection and cut + copy Taner Kalkay Excel Programming 2 July 2nd 04 01:15 PM


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