+ Reply to Thread
Results 1 to 2 of 2

Check relative / absolute references

  1. #1
    Registered User
    Join Date
    06-03-2005
    Posts
    4

    Question Check relative / absolute references

    Hello,

    I want to find the cells with absolute reference and the ones without abolute reference.

    I tried this way (seems to work ...):


    Option Explicit

    Sub check_ref()
    Dim vAnzZeilen As Long, vZnr As Long
    Dim vInCell As String
    vAnzZeilen = Worksheets(1).UsedRange.Rows.Count
    MsgBox "rows: " & vAnzZeilen

    For vZnr = 2 To vAnzZeilen
    vInCell = Worksheets(1).Cells(vZnr, 1).FormulaLocal
    ' check content of the cell
    If InStr(vInCell, "$") Then
    Debug.Print vInCell & ": absolute"
    Else
    Debug.Print vInCell & ": relative"
    End If
    Next vZnr
    End Sub


    Is there a better way (function or method) to do this.

    I would like to do the same check to find which cells refenrences a name.

    Thanks.

    Olivier

  2. #2
    Tom Ogilvy
    Guest

    Re: Check relative / absolute references

    In my opinion:
    for checking column A, that would pretty much be it. You could narrow it
    down to only look at cells with formulas by using specialcells, but for
    absolute and relative, checking the formula string would be required. As
    for searching for a name, seeing if the formula string contained the name
    would be as good as any.

    --
    Regards,
    Tom Ogilvy

    "oli" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hello,
    >
    > I want to find the cells with absolute reference and the ones without
    > abolute reference.
    >
    > I tried this way (seems to work ...):
    >
    >
    > Option Explicit
    >
    > Sub check_ref()
    > Dim vAnzZeilen As Long, vZnr As Long
    > Dim vInCell As String
    > vAnzZeilen = Worksheets(1).UsedRange.Rows.Count
    > MsgBox "rows: " & vAnzZeilen
    >
    > For vZnr = 2 To vAnzZeilen
    > vInCell = Worksheets(1).Cells(vZnr, 1).FormulaLocal
    > ' check content of the cell
    > If InStr(vInCell, "$") Then
    > Debug.Print vInCell & ": absolute"
    > Else
    > Debug.Print vInCell & ": relative"
    > End If
    > Next vZnr
    > End Sub
    >
    > Is there a better way (function or method) to do this.
    >
    > I would like to do the same check to find which cells refenrences a
    > name.
    >
    > Thanks.
    >
    > Olivier
    >
    >
    > --
    > oli
    > ------------------------------------------------------------------------
    > oli's Profile:

    http://www.excelforum.com/member.php...o&userid=24000
    > View this thread: http://www.excelforum.com/showthread...hreadid=384474
    >




+ 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