Closed Thread
Results 1 to 2 of 2

Sheet to sheet copy

  1. #1
    Registered User
    Join Date
    05-03-2007
    Posts
    26

    Sheet to sheet copy

    Dear Experts

    I want to copy sheets("Table") to sheets("View")

    But before copy: I want to clear contents of target sheet range("a3:z1000")

    I wrote following procedure but it shows error message 1004.

    Please help

    PHP Code: 
    Private Sub CommandButton7_Click()

    Sheets("View").Select
    Range
    ("A3:H1000").Select
    Selection
    .ClearContents

    Sheets
    ("Table").Select  ' source sheet
    Range("A:Z").Select
    Selection.Copy
        
    Sheets("View").Select   '
    Target sheet
    Range
    ("A3").Select
    ActiveSheet
    .Paste
    Columns
    .AutoFit
      
    End Sub 

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    As you have not said which line of code is causing the problem I will guess it is when you try and paste. If this is the case I think it is caused by you copying columns and trying to paste into a cell. or when you try and select A3


    This macro will may fix your problem and also shows you a way to simplfy your code

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1