+ Reply to Thread
Results 1 to 2 of 2

Simple copy paste problem

Hybrid View

  1. #1
    Registered User
    Join Date
    11-28-2006
    Posts
    55

    Simple copy paste problem

    Hi
    Can anyone help.
    I'm trying to copy a range of values (the size of the range changes) and paste them into another sheet within th esame workbook.
    My code copies the data no problem. It selects the worksheet with no problems and then it falls over on what should be the simplest bit. the pasting
    Any ideas?
    You'll see from the code that i dont really know what I'm doing!!!

    Public Sub Non_HH_Calculate()

    Sheets("Non HH Variables").Select

    columa = Sheets("Variables").Range("g5")

    rowa = 8

    'selects Non Household areas entered and carries them through to the workbook

    If Sheets("Non HH Variables").Range("o4") = "Breakdown" Then
    Sheets("Non HH Variables").Select
    Cells(rowa, 6).Select
    Range(Selection, columa & 23).Select
    Selection.Copy

    'Selects next worksheet and should paste in data but fails

    Sheets("Non-Household").Select
    Range("f5").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False

    End If

    End Sub


    I get a run-time error '1004': Application-defined or object-defined error warning.

  2. #2
    Registered User
    Join Date
    11-28-2006
    Posts
    55
    Fixed it. Moved the code to a module as opposed to having it in the worksheet. Anyone know why this is the case?

    Cheers

+ Reply to 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