+ Reply to Thread
Results 1 to 8 of 8

VB code to filter and move positive number to another column

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB code to filter and move positive number to another column

    Hello:

    Please refer to attached file.
    I have data as shown.
    Need VB Code to cut and paste all positive data from column E and paste at its respective row in column F.
    In this case highlighed will be moved @ cell F9
    Once this is done then select column E and convert all cells to positive number.
    Lastly, need formula to be added in cell H2 down to the last row of the data.
    Formula in cell H2 = H1+E2+F2 and copy down.

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: VB code to filter and move positive number to another column

    Something like below?
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VB code to filter and move positive number to another column

    Not sure I've understood the requirement fully, but from my interpretation of post#1 perhaps this:
    Please Login or Register  to view this content.
    BSB

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: VB code to filter and move positive number to another column

    Ah, I had missed convert E to positive. Modified code below.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: VB code to filter and move positive number to another column

    And I missed the CUT and paste so my amended code is:
    Please Login or Register  to view this content.
    We get the same results now at least

    BSB

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB code to filter and move positive number to another column

    Hello CK and Badly:

    Works great, thanks a lot.
    Last request, need to do search in column C for DEPOSIT ***** and change to DEPOSIT.
    Please help get the code for this.

    Thanks

    Riz

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,913

    Re: VB code to filter and move positive number to another column

    Combining all, something like below. Or you can do Column C separately.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! try this ‼

    Quote Originally Posted by rizmomin View Post
    Please refer to attached file.
    Like operating manually as a beginner starter :

    PHP Code: 
    Sub Demo1()
                     
    Dim Rg As Range
        With Sheet1
    .UsedRange.Rows
                 
    .Columns(5).AutoFilter 1">0"
            
    With .Item("2:" & .Count).Columns
                 
    .Item(5).Copy .Item(6)
                 .
    Item(5).ClearContents
                 
    .AutoFilter
                 
    .Item(5).Value2 = .Parent.Evaluate(Replace("IF(#<0,-#,"""")""#", .Address))
                 .
    Item(8).Formula "=H1+E2+F2"
                     
    Set Rg = .Item(3).Find("Deposit *", , xlValuesxlWhole)
                Do 
    Until Rg Is Nothing
                         Rg
    .Value2 "Deposit"
                     
    Set Rg = .Item(3).FindNext(Rg)
                
    Loop
            End With
        End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 08-09-2018 at 12:34 PM. Reason: mod for deposit …

+ 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. Find next positive number in column after specified vaue
    By lar9149 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 10-07-2016, 06:29 PM
  2. CountA - stop counting in column when number changes positive or negative
    By Hallgente in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-26-2016, 01:04 PM
  3. [SOLVED] Sum the first x number of positive values in a column
    By JimDandy in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-16-2015, 05:08 PM
  4. Replies: 3
    Last Post: 11-17-2014, 11:09 AM
  5. Carrying Over Negative number to next column as a positive number
    By Redraven in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2014, 06:39 AM
  6. sum only positive number in skip column
    By NNancy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-30-2014, 05:12 PM
  7. Move Negative Number and Change to a Positive Number
    By Alvin Hunter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2013, 08:36 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