+ Reply to Thread
Results 1 to 8 of 8

Selecting cells from a list greater than zero and pasting to another sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    Selecting cells from a list greater than zero and pasting to another sheet

    What I am trying to do is a little advanced for me and I need help. I am trying to find all the cells in a list that have a value greater than zero and copy them, then paste them in order onto another sheet. Right now I have a code than only finds a specific value, but not values greater than zero. Here is an attachment that finds only a specific value and only highlights the cell, not copy and paste it.

    Thank you


    Test File.xlsm

  2. #2
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Hi pasqualebaldi,
    try it
    Sub ertert()
    Dim r As Range
    With Sheets("Sheet1")
        With .Range("A1", .Cells(Rows.count, 1).End(xlUp))
            Set r = .Find(0, lookat:=xlWhole)
            If Not r Is Nothing Then
                .ColumnDifferences(r).Copy Sheets("Sheet2").Range("A1")
            End If
        End With
    End With
    End Sub

  3. #3
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Thank you! I thought I would be able to tweak the code a little to add a few cells to copy in addition, but I'm not familiar enough with this code. I've attach another file with what exactly I am trying to accomplish. I appreciate your time.

    Thank you


    Test File2.xlsm

  4. #4
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Hi pasqualebaldi,

    Hope this helps. I just created a macro using the filter and then sorting it.

    Test File.xlsm
    BrownBoy

    If happy, mark "SOVLED" & add to "REP"

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    please try again
    Private Sub Button2_Click()
    Dim r As Range
    With Sheets("Sheet1").Range("B14").CurrentRegion
        Set r = .Columns(3).Find(0, lookat:=xlWhole)
        If Not r Is Nothing Then
            Intersect(.Cells, .Columns(3).ColumnDifferences(r).EntireRow).Copy Sheets("Sheet2").Range("A1")
        End If
    End With
    End Sub

  6. #6
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Quote Originally Posted by nilem View Post
    please try again
    Private Sub Button2_Click()
    Dim r As Range
    With Sheets("Sheet1").Range("B14").CurrentRegion
        Set r = .Columns(3).Find(0, lookat:=xlWhole)
        If Not r Is Nothing Then
            Intersect(.Cells, .Columns(3).ColumnDifferences(r).EntireRow).Copy Sheets("Sheet2").Range("A1")
        End If
    End With
    End Sub
    Nilem, that worked great thank you! Out of curiosity, is it possible to look up the price value greater than zero, like it currently is doing, and then only paste the item name on "sheet 2" and not the item price or item #?

    Thank you

  7. #7
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Private Sub Button2_Click()
    Dim r As Range
    With Sheets("Sheet1").Range("B14").CurrentRegion
        Set r = .Columns(3).Find(0, lookat:=xlWhole)
        If Not r Is Nothing Then
            Intersect(.Columns(1), .Columns(3).ColumnDifferences(r).EntireRow).Copy Sheets("Sheet2").Range("A1")
        End If
    End With
    End Sub

  8. #8
    Forum Contributor
    Join Date
    09-09-2013
    Location
    California, USA
    MS-Off Ver
    MS 365 Subscription
    Posts
    130

    Re: Selecting cells from a list greater than zero and pasting to another sheet

    Quote Originally Posted by nilem View Post
    Private Sub Button2_Click()
    Dim r As Range
    With Sheets("Sheet1").Range("B14").CurrentRegion
        Set r = .Columns(3).Find(0, lookat:=xlWhole)
        If Not r Is Nothing Then
            Intersect(.Columns(1), .Columns(3).ColumnDifferences(r).EntireRow).Copy Sheets("Sheet2").Range("A1")
        End If
    End With
    End Sub

    Nilem,
    I hope you had a good weekend. I'm sorry to bring up this up again, but I am trying to use this code on another sheet and I am having trouble. In the file I have attached, this code works great taking information from Sheet2 and putting it onto Sheet3. I tried to use this code to take information from Sheet1 and also put it on Sheet3, but I can not get the code to do anything. If you could help, I appreciate your time.

    Thank you

    New Test File.xlsm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro for Selecting and Pasting into new cells??
    By velocitygraphix in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-04-2014, 01:55 PM
  2. Replies: 11
    Last Post: 10-16-2013, 11:20 AM
  3. Selecting, copy and pasting cells
    By patigonia in forum Excel General
    Replies: 9
    Last Post: 05-29-2012, 09:08 PM
  4. Selecting full cells on sheet1 and pasting into first available blank cell on sheet2
    By Kully_Singh in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-08-2012, 07:34 PM
  5. Selecting Cells With Sumproduct Formula, Then Pasting Its Value Over Top
    By Carroll in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2005, 02:05 PM

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