Consulting

Results 1 to 6 of 6

Thread: Solved: With End With Copy PasteSpecial Help

  1. #1

    Solved: With End With Copy PasteSpecial Help

    I am attempting to copy a range of data from 1 worksheet to another using PasteSpecial.
    Wss is Worksheet source
    Ash is Activesheet target

    1st error is on line: Type mismatch
    [VBA]With Sheets(Wss)[/VBA]


    [VBA]Ash.Range("A4", Ash.Cells(LastRow, "H")).ClearContents
    With Sheets(Wss)
    .Range("L2:S2" & LRow).Copy
    End With
    With Sheets(Ash)
    .Range("A4").PasteSpecial
    End With[/VBA]
    I thought I had this qualified correclty, w/ the heirarchy of Range coming in below Worksheet object....
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  2. #2
    I have the With, worked out: but it is only copying row 1, not the range to the bottom for some reason... there are 12,000 rows of data....

    [VBA]
    LastRow = Ash.Cells(Rows.Count, 1).End(xlUp).Row
    LRow = Wss.Cells(Rows.Count, "L").End(xlUp).Row

    With Wss
    .Range("L2:S2" & LRow).Copy
    End With
    With Ash
    .Range("A4").PasteSpecial
    End With
    [/VBA]
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Just guessig here Doug, but why not try the .End(xlUp).Row after "copy" and leave out LRow, and see what happens?

    Someone with some knowlege will be along soon
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  4. #4
    Ted,
    Big no no there.
    That copies the whole row over onto the target sheet..... good thing I save after each successful change or I would be in tears right now... :-)

    Something is not just right here, I will keep searching, but thanks for the try
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  5. #5
    The original code is below, but I am trying to either re-work it slightly or understand it better.
    This code does copy and paste the entire range, I am trying to understand why my version only copies and pastes the first row in the range?
    I have switched up the hardcoded sheet names w/ variables.
    DataEdited= Wss
    PCCombined_FF= Ash
    [vba]
    With Sheets("DataEdited").Range("L2:S2")
    Sheets("DataEdited").Range(.Cells, .Cells.End(xlDown)).Copy
    End With
    With Sheets("PCCombined_FF")
    .Range("A4").PasteSpecial
    End With
    [/vba]
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

  6. #6
    I found my error:
    The range was off:
    L2:S2

    Should have been:
    L2:S
    my site: www.ecboardco.com
    was built w/ a majority of the assistance from the board members here... thanks VBAX.

    Just because I see something, doesn't mean that what's actually happening is what I see.

    You don't get from 0-90 by standing still!

Posting Permissions

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