+ Reply to Thread
Results 1 to 3 of 3

Easy but I can't find it!

  1. #1

    Easy but I can't find it!

    I worship at the fountain of your boolean minds:

    I have two macro's for excel I want to pilfer, plunder and make
    extremely good use of:

    The first would dash through a sheet, looking for different names,
    recognize 'Jane', 'Jim', or 'Josh' and 'highlight' the entire 'row; in
    which their name appeared in col C: green, blue, or yellow.

    The second macro would look at Column A, if it contained a '0', copy it
    to 'Sheet 2' and then delete it from from sheet 1.

    I may not be describing what I'm looking for very well, and if you can
    point me to where they have been previously discussed, or create them
    here: you deserve praise and eternal life.

    THANKS!


  2. #2
    Don Guillett
    Guest

    Re: Easy but I can't find it!

    Eternal life!!
    for the 1st, look in vba help for FINDNEXT
    for the 2nd, you just sort or filter>autofilter>for 0 and do your stuff.

    --
    Don Guillett
    SalesAid Software
    [email protected]
    <[email protected]> wrote in message
    news:[email protected]...
    >I worship at the fountain of your boolean minds:
    >
    > I have two macro's for excel I want to pilfer, plunder and make
    > extremely good use of:
    >
    > The first would dash through a sheet, looking for different names,
    > recognize 'Jane', 'Jim', or 'Josh' and 'highlight' the entire 'row; in
    > which their name appeared in col C: green, blue, or yellow.
    >
    > The second macro would look at Column A, if it contained a '0', copy it
    > to 'Sheet 2' and then delete it from from sheet 1.
    >
    > I may not be describing what I'm looking for very well, and if you can
    > point me to where they have been previously discussed, or create them
    > here: you deserve praise and eternal life.
    >
    > THANKS!
    >




  3. #3

    Re: Easy but I can't find it!

    I'm just trying to autamaton the process to save some time.

    For the second I'm looking at this, which was written for a string
    search, and has an error message right now, so maybe someone can help
    me out a bit on what it's doing wrong: I suppose I need to convert it
    to a number search or something and add a Selection.delete... But I'm
    just guessing as this is the second macro I've ever tried!

    Still don't know about numero uno.


    Sub SearchForString()

    Dim LSearchRow As Integer
    Dim LCopyToRow As Integer

    On Error GoTo Err_Execute

    'Start search in row 2
    LSearchRow = 2

    'Start copying data to row 2 in Done (row counter variable)
    LCopyToRow = 2

    While Len(Range("A" & CStr(LSearchRow)).Value) > 0

    'If value in column A = "0", copy entire row to Sheet2
    If Range("A" & CStr(LSearchRow)).Value = "0" Then

    'Select row in Sheet1 to copy
    Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
    Selection.Copy


    'Paste row into Sheet2 in next row
    Sheets("Sheet2").Select
    Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
    ActiveSheet.Insert

    'Move counter to next row
    LCopyToRow = LCopyToRow + 1



    'Go back to Sheet1 to continue searching
    Sheets("Sheet1").Select

    End If

    LSearchRow = LSearchRow + 1

    Wend

    'Position on cell A3
    Application.CutCopyMode = False
    Range("A3").Select

    MsgBox "All matching data has been copied."

    Exit Sub

    Err_Execute:
    MsgBox "An error occurred."

    End Sub


+ 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