POV-Ray : Newsgroups : povray.off-topic : VBA confusion Server Time
29 Jul 2024 04:21:09 EDT (-0400)
  VBA confusion (Message 1 to 1 of 1)  
From: Shay
Subject: VBA confusion
Date: 16 Mar 2012 09:40:02
Message: <web.4f63419ac083d62c2421da0@news.povray.org>
Excel 2007
Been playing with this. A lot of guesswork, but I've made some progress. I'm
stuck at this point, however.


Public Function Location$()
    ' search back in a column of:
    ' name
    ' date
    ' location
    ' name
    ' date
    ' location
    ' name
    ' date
    ' location
    ' and copy the location from two days ago.

    Dim foundrow As Long
    Dim searchcol As Range
    Set searchcol = ActiveCell.Columns("A:A").EntireColumn

    foundrow = WorksheetFunction.Match( _
        CLng(ActiveCell.Offset(-1, 0).Range("A1")) - 2, _
        searchcol, 0)

    'Below works fine--as long as I want column C
    'Location = Range("C:C")(foundrow + 1, 1).Text

    'This one doesn't work and I don't know why
    Location = searchcol(foundrow + 1, 1).Text

End Function


Something fundamental I don't understand here. Thanks for any help.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.