Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2006, 09:00 AM
Registered User
 
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy visible cells in a macro?Runtime 438 error?

As part of my macro, I am trying to take a selection, copy the visible cells, and paste them on another sheet.

I want to select current region, select all visible cells and copy them to another sheet. I can do this normally, but when I try to program it to a macro it says

Right now the code looks like this

    Sheets.Add
    Sheets("Sheet1").Select
    Sheets("Sheet1").Name = "Visible"
    Sheets("NotAssignedTSC").Select
    Range("D586").Select
    Selection.CurrentRegion.Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Visible").Select
    Selection.Paste


It will give me an error saying "Run-time error '438 Object Doesn't support this property or method'

Does anyone have any idea how I can fix this code to make it work? Is there another paste command I don't know about? After I get out of the error, I can hit enter in the cell I want and the selection I want will paste. I want it to be part of the macro.

Thanks,

~J
 
Old July 22nd, 2006, 01:20 AM
Authorized User
 
Join Date: Jul 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For example:
    Sheets.Add
    '''''''''''''''''''''Sheets("Sheet1").Select
    ActiveSheet.Name = "Visible"
    '''''''''''''''''''''Sheets("Sheet1").Name = "Visible"
    Sheets("NotAssignedTSC").Select
    Range("D586").Select
    Selection.CurrentRegion.Select
    Selection.SpecialCells(xlCellTypeVisible).Select
    Selection.Copy
    Sheets("Visible").Select
    Range("F2").Select' for example
    ActiveSheet.Paste
    Application.CutCopyMode = False
    '''''''''''''''''''''Selection.Paste
Kazik

 
Old April 7th, 2010, 11:13 AM
Registered User
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try using:

selection.pastespecial





Similar Threads
Thread Thread Starter Forum Replies Last Post
run-time error '438' in excel 2003 hugoscp Excel VBA 9 May 13th, 2009 05:08 AM
Disabling copy function for selected cells yatinjhamb Excel VBA 3 March 21st, 2008 04:01 AM
error 438 samuel2680 Excel VBA 1 January 2nd, 2008 12:49 PM
Copy visible cells paul20091968 Excel VBA 2 January 3rd, 2007 11:43 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.