Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Why need to use Selection.PasteSpecial vs myRange.PasteSpecial

2003/2007

This code works:
Dim SrchAcctRng as Range

SrchAcctRng.Select
SrchAcctRng.Copy
Selection.PasteSpecial xlPasteValues

Next code fails in range class
Dim SrchAcctRng as Range

SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues

Note that SrchAcctRng is a filtered range as a result of:

Set SrchAcctRng = wks.Range(Cells(PrintRow + 1, PrintCol).Address, _
Cells(wks.Cells(Rows.Count, 1).End(xlUp).Row - 1, PrintCol)).SpecialCells(xlCellTypeVisible)


I do not usderstand why I need to use Selection.PasteSpecial xlPasteValues?

TIA EagleOne
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Why need to use Selection.PasteSpecial vs myRange.PasteSpecial

What happens if you add:

SrchAcctRng.Select

to the second example?

Mark Lincoln

On Jun 25, 11:15 am, wrote:
2003/2007

This code works:
Dim SrchAcctRng as Range

SrchAcctRng.Select
SrchAcctRng.Copy
Selection.PasteSpecial xlPasteValues

Next code fails in range class
Dim SrchAcctRng as Range

SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues

Note that SrchAcctRng is a filtered range as a result of:

Set SrchAcctRng = wks.Range(Cells(PrintRow + 1, PrintCol).Address, _
Cells(wks.Cells(Rows.Count, 1).End(xlUp).Row - 1, PrintCol)).SpecialCells(xlCellTypeVisible)

I do not usderstand why I need to use Selection.PasteSpecial xlPasteValues?

TIA EagleOne



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Why need to use Selection.PasteSpecial vs myRange.PasteSpecial

this works for me:

Sub test()
Dim ws As Worksheet
Dim SrchAcctRng As Range
Set ws = Worksheets("sheet1")
Set SrchAcctRng = ws.Range("A1:C2")
SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues
End Sub

--


Gary


wrote in message
...
2003/2007

This code works:
Dim SrchAcctRng as Range

SrchAcctRng.Select
SrchAcctRng.Copy
Selection.PasteSpecial xlPasteValues

Next code fails in range class
Dim SrchAcctRng as Range

SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues

Note that SrchAcctRng is a filtered range as a result of:

Set SrchAcctRng = wks.Range(Cells(PrintRow + 1, PrintCol).Address, _
Cells(wks.Cells(Rows.Count, 1).End(xlUp).Row - 1,
PrintCol)).SpecialCells(xlCellTypeVisible)


I do not usderstand why I need to use Selection.PasteSpecial xlPasteValues?

TIA EagleOne



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Why need to use Selection.PasteSpecial vs myRange.PasteSpecial

sorry, didn't see the filtered range

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
this works for me:

Sub test()
Dim ws As Worksheet
Dim SrchAcctRng As Range
Set ws = Worksheets("sheet1")
Set SrchAcctRng = ws.Range("A1:C2")
SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues
End Sub

--


Gary


wrote in message
...
2003/2007

This code works:
Dim SrchAcctRng as Range

SrchAcctRng.Select
SrchAcctRng.Copy
Selection.PasteSpecial xlPasteValues

Next code fails in range class
Dim SrchAcctRng as Range

SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues

Note that SrchAcctRng is a filtered range as a result of:

Set SrchAcctRng = wks.Range(Cells(PrintRow + 1, PrintCol).Address, _
Cells(wks.Cells(Rows.Count, 1).End(xlUp).Row - 1,
PrintCol)).SpecialCells(xlCellTypeVisible)


I do not usderstand why I need to use Selection.PasteSpecial xlPasteValues?

TIA EagleOne





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Why need to use Selection.PasteSpecial vs myRange.PasteSpecial

Thanks for the thoughts.

Here is what I found:

Using 2007, I had not enabled macros (prompt at open) for the WB in which I was "processing" with
VBA.

When I would get a "macros not enabled" notice, I would reselect Personal.xls in the VBE Explorer
and continue editing as if nothing was wrong.

By not enabling macros in the object w/b, "some" - but not all - of the VBA code would process.

In short, If I enabled macros the object w/b in 2007, all VBA works fine. If not, only some VBA
worked.

Thanks EagleOne

wrote:

2003/2007

This code works:
Dim SrchAcctRng as Range

SrchAcctRng.Select
SrchAcctRng.Copy
Selection.PasteSpecial xlPasteValues

Next code fails in range class
Dim SrchAcctRng as Range

SrchAcctRng.Copy
SrchAcctRng.PasteSpecial xlPasteValues

Note that SrchAcctRng is a filtered range as a result of:

Set SrchAcctRng = wks.Range(Cells(PrintRow + 1, PrintCol).Address, _
Cells(wks.Cells(Rows.Count, 1).End(xlUp).Row - 1, PrintCol)).SpecialCells(xlCellTypeVisible)


I do not usderstand why I need to use Selection.PasteSpecial xlPasteValues?

TIA EagleOne

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
Why does Selection.PasteSpecial toggle Application.ScreenUpdating OssieMac Excel Worksheet Functions 2 August 4th 09 12:05 AM
Exporting Logo from Access 97 to Excel 2000 by copy and pastespecial is stopping Cell A1 selection sid[_3_] Excel Programming 1 June 11th 07 11:01 AM
Selection.PasteSpecial with Office 2003 Andreas Szabo Excel Programming 2 November 3rd 05 02:17 PM
selection.pastespecial problem rleonard[_2_] Excel Programming 1 May 31st 04 10:56 AM


All times are GMT +1. The time now is 11:49 PM.

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

About Us

"It's about Microsoft Excel"