+ Reply to Thread
Results 1 to 2 of 2

Error routine needed

  1. #1
    Jeff Wright
    Guest

    Error routine needed

    Hi, everyone !



    I have a range with data and formulas from A1:F40 (called "Rng"). My
    workbook includes a macro (below) which can be initiated by the user,
    clearing the contents of any given row, but leaving the formulas intact:



    ActiveCell.EntireRow.SpecialCells(xlCellTypeConstants).ClearContents



    However, I want to include an error routine in my macro which will prevent
    the user from clearing a row if the active cell is not in "Rng."



    As usual, your help is greatly appreciated.



    Thanks,





    Jeff Wright



  2. #2
    David
    Guest

    RE: Error routine needed

    Hi,
    Try this in your routine:
    Sub Macro1()
    If ActiveCell.Row <= 40 Then
    ActiveCell.EntireRow.SpecialCells(xlCellTypeConstants).ClearContents
    End If
    End Sub

    Thanks,

    "Jeff Wright" wrote:

    > Hi, everyone !
    >
    >
    >
    > I have a range with data and formulas from A1:F40 (called "Rng"). My
    > workbook includes a macro (below) which can be initiated by the user,
    > clearing the contents of any given row, but leaving the formulas intact:
    >
    >
    >
    > ActiveCell.EntireRow.SpecialCells(xlCellTypeConstants).ClearContents
    >
    >
    >
    > However, I want to include an error routine in my macro which will prevent
    > the user from clearing a row if the active cell is not in "Rng."
    >
    >
    >
    > As usual, your help is greatly appreciated.
    >
    >
    >
    > Thanks,
    >
    >
    >
    >
    >
    > Jeff Wright
    >
    >
    >


+ 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