+ Reply to Thread
Results 1 to 2 of 2

If Then Help!!!!

Hybrid View

Guest If Then Help!!!! 07-11-2005, 01:05 PM
Guest Re: If Then Help!!!! 07-11-2005, 01:05 PM
  1. #1
    A Waller
    Guest

    If Then Help!!!!

    Hi!

    I'm stuck. I have a working macro but it needs a small tweek. The macro
    executes a find statement and performs calculations from the find to the end
    of the column. The problem is when nothing is found. I need an if statement
    or suggestion on how to tell it to skip the calculations if there is nothing
    found. This is what I have so far(with no if's):

    Cells.Find(What:="RIM", After:=ActiveCell, LookIn:=xlFormulas _
    , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False).Activate
    Selection.End(xlToRight).Select
    ActiveCell.Offset(0, 1).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Cut
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    Range(ActiveCell, ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1)) _
    .FormulaR1C1 = "=RC[-1]*RC[6]/12"
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Cut
    ActiveCell.Offset(0, -2).Select
    ActiveSheet.Paste

    Thanks in advance for all your help.
    --
    A Waller



  2. #2
    Tom Ogilvy
    Guest

    Re: If Then Help!!!!

    set rng = Cells.Find(What:="RIM", After:=ActiveCell, LookIn:=xlFormulas _
    , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False)
    if not rng is nothing then
    rng.select
    Selection.End(xlToRight).Select
    ActiveCell.Offset(0, 1).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Cut
    ActiveCell.Offset(0, 1).Select
    ActiveSheet.Paste
    ActiveCell.Offset(0, 1).Select
    Range(ActiveCell, ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1)) _
    .FormulaR1C1 = "=RC[-1]*RC[6]/12"
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Cut
    ActiveCell.Offset(0, -2).Select
    ActiveSheet.Paste
    end if

    --
    rEgards,
    Tom Ogilvy


    "A Waller" <AWaller@discussions.microsoft.com> wrote in message
    news:A27A5D8D-FDB7-4EB4-9DA4-F877D169550B@microsoft.com...
    > Hi!
    >
    > I'm stuck. I have a working macro but it needs a small tweek. The macro
    > executes a find statement and performs calculations from the find to the

    end
    > of the column. The problem is when nothing is found. I need an if

    statement
    > or suggestion on how to tell it to skip the calculations if there is

    nothing
    > found. This is what I have so far(with no if's):
    >
    > Cells.Find(What:="RIM", After:=ActiveCell, LookIn:=xlFormulas _
    > , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,

    _
    > MatchCase:=False, SearchFormat:=False).Activate
    > Selection.End(xlToRight).Select
    > ActiveCell.Offset(0, 1).Select
    > Range(Selection, Selection.End(xlDown)).Select
    > Selection.Cut
    > ActiveCell.Offset(0, 1).Select
    > ActiveSheet.Paste
    > ActiveCell.Offset(0, 1).Select
    > Range(ActiveCell, ActiveCell.Offset(0, -1).End(xlDown).Offset(0, 1)) _
    > .FormulaR1C1 = "=RC[-1]*RC[6]/12"
    > Range(Selection, Selection.End(xlDown)).Select
    > Selection.Cut
    > ActiveCell.Offset(0, -2).Select
    > ActiveSheet.Paste
    >
    > Thanks in advance for all your help.
    > --
    > A Waller
    >
    >




+ 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