+ Reply to Thread
Results 1 to 3 of 3

Thread: With and End with, Offset Multiple sheets

  1. #1
    Registered User
    Join Date
    04-17-2011
    Location
    Orlando
    MS-Off Ver
    Excel 2007
    Posts
    27

    Exclamation With and End with, Offset Multiple sheets

    Okay so I have this code that copies the contents of one cell (A1) and pastes it into anouther (B1). the next time the code is ran, (A1) will be pasted into (B2)
    See Code below:


    With Sheet1
        .Cells(.Rows.Count, 2).End(xlUp).Offset(1, 0).Value = .Range("A1").Value
    End With
    I have had to change a few things around due to expanding.

    Is there anyway I can do this where The cell that's being copied is on a different sheet than the destination of the paste?


    Help please!
    Last edited by Crebsington; 08-17-2011 at 10:44 PM. Reason: Solved!!

  2. #2
    Forum Guru Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,276

    Re: With and End with, Offset Multiple sheets

    Does something like the following help?
    Sub Crebsington()
        Dim Ws1 As Worksheet, Ws2 As Worksheet
        
        Set Ws1 = Worksheets("Sheet1")
        Set Ws2 = Worksheets("Sheet2")
        
        Ws1.Cells(Ws1.Rows.Count, 2).End(xlUp).Offset(1, 0).Value = Ws2.Range("A1").Value
    
    End Sub
    Please leave a message after the beep!

  3. #3
    Registered User
    Join Date
    04-17-2011
    Location
    Orlando
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: With and End with, Offset Multiple sheets

    This Is perfect! Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0