+ Reply to Thread
Results 1 to 4 of 4

Copy rows which have a value over 40

Hybrid View

DanzaNZ Copy rows which have a value... 11-10-2013, 10:12 PM
ragulduy Re: Copy rows which have a... 11-11-2013, 05:58 AM
DanzaNZ Re: Copy rows which have a... 11-11-2013, 07:18 PM
ragulduy Re: Copy rows which have a... 11-12-2013, 05:12 AM
  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    Copy rows which have a value over 40

    Hi all

    I have this great code which copies a value based on text in a row; however I would like to alter it to only copy rows is a value within the text if over 40
    Eg: there are rows that have text "ALTTT", then also have a number in the text like: "ALTTT .000 D."

    How would I alter my code to only copy that rows if the "ALTTT" value is more the "40.00 D"

    Sub test()
        Dim myAreas As Areas, myArea As Range, x, r As Range
        With Sheets("Source")
            With .Range("a1", .Range("a" & Rows.Count).End(xlUp)).Offset(, 1)
                .Formula = "=if(iserror(find(""++"",a1)),1,"""")"
                Set myAreas = .SpecialCells(-4123, 1).Areas
                .Clear
            End With
        End With
        For Each myArea In myAreas
            x = Application.Match("*ALTTP*", myArea.Offset(, -1), 0)
            If IsError(x) Then
                x = Application.Match("*ALTTT*", myArea.Offset(, -1), 0)
                If IsNumeric(x) Then
                    x = Application.Match("*Teacher*", myArea.Offset(, -1), 0)
                    If IsNumeric(x) Then
                        If r Is Nothing Then
                            Set r = myArea(x, 0).Resize(2)
                        Else
                            Set r = Union(r, myArea(x, 0).Resize(2))
                        End If
                    End If
                End If
            End If
        Next
        If Not r Is Nothing Then r.Copy Sheets("8% Calculations required").Cells(1)
    End Sub

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy rows which have a value over 40

    Will there always be spaces between text and the number, if so you can do something like:
    Sub Macro_1()
    dim str, count
    str = "ALTTT 123.124 !ofasd"
    str = split(str)
    for count = 0 to Ubound(str)
      if isnumeric(str(count)) then
        if str(count)>40 then
          msgbox "number over 40"
        end if
      end if
    next

  3. #3
    Forum Contributor
    Join Date
    06-24-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    124

    Re: Copy rows which have a value over 40

    Thanks for that

    I am having trouble including that to my current code.
    Are you able to put your example in my code?

    Thanks
    Dan

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Copy rows which have a value over 40

    I couldn't really follow your code. I can give you some code to do the same thing if you can give more details of your requirements. Upload an example workbook with a sample of your data and a sample of the desired output. Add a brief description of what the macro should do.

+ 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] VBA Split Cell Contents to New Rows & Copy Cells containing single values to the new rows
    By jaimelwilson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-14-2017, 05:30 PM
  2. Copy the employee Ids to subsequent rows (approx 30 rows) using macro - Roster Type
    By Keerthi Raj in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-21-2013, 01:10 AM
  3. Replies: 0
    Last Post: 05-10-2013, 12:04 PM
  4. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  5. Replies: 0
    Last Post: 08-30-2010, 10:30 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