+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : [SOLVED]Paste Value to next empty cell

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    [SOLVED]Paste Value to next empty cell

    Hey guys quick question, i have a macro that pastes cells to the next empty row on another worksheet

    If Range("F8").Value <> "SD" Or "RD" Then
       last = Worksheets(Range("G8").Value).Cells.Find(What:="*", _
       After:=[A1], _
       Lookat:=xlPart, _
       LookIn:=xlFormulas, _
       SearchOrder:=xlByRows, _
       SearchDirection:=xlPrevious, _
       MatchCase:=False).Row
       sheets("SHIPREC").Range("D8:E8").Copy sheets(Range("G8").Value).Cells(last + 1, 1)
    End If
    how do i get it to paste the value only instead of the formulas? i tried paste special.
    Last edited by GaidenFocus; 11-02-2010 at 03:00 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Paste Value to next empty cell

    This should do to replace all that:
    If Range("F8").Value <> "SD" Or "RD" Then _
       Sheets(Range("G8").Value).Cells(Rows.Count, 1).End(xlUp) _
        .Offset(1).Resize(, 2).Value = Sheets("SHIPREC").Range("D8:E8")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Paste Value to next empty cell

    thanks man, had to modify it a little didn't seem to work till i deleted that _ after the if statement. How would i do this with a non contiguous selection? i know how to select non contiguous cells but im not sure how to implement it into something like this

    B6 will be in the A column and D7 will be in the B column.
    Application.Union(Range("B6"), Range("D7")).Select

  4. #4
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Paste Value to next empty cell

    nevermind i got it to work, thanks so much for your help!

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Paste Value to next empty cell

    Huh, what?

    Show use what you're doing on an actual sample workbook to alleviate headaches (ours). Hehe.

    Click GO ADVANCED and use the paperclip icon to post up a desensitized copy of your workbook.

  6. #6
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: Paste Value to next empty cell

    Huh what to you too?

    i got it to work man, if you look at your code you have an underscore after "then". it gave me an error till i deleted it.

    so now it looks like this

       sheets(Range("E8").Value).Cells(Rows.Count, 1).End(xlUp) _
        .Offset(1).Resize(, 1).Value = Range("B6").Value
        
       sheets(Range("E8").Value).Cells(Rows.Count, 2).End(xlUp) _
        .Offset(1).Resize(, 1).Value = Range("D7").Value
    and it works great.

+ 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