Results 1 to 4 of 4

Checking Offset Assumptions

Threaded View

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    St. John's, Canada
    MS-Off Ver
    Excel 2010
    Posts
    70

    Checking Offset Assumptions

    Hey Everyone,

    I'm trying to create a check in my Excel Macro to check if my assumptions are correct. For example in a given worksheet I want to find the row labeled "Mouse/Day". Once I've found this row I assume the column "Cat" is one column to the right. But what if it wasn't? what if the columns had been input in a wrong order. Instead of the cat column being at an offset of ( 0, 1) the dog column was there instead. Is there a creative way to check ?

    Thanks for your help everyone! You've all been great these past weeks.

    Sub ColumnMatchTest()
    
    
    Dim Cat As Range
    Dim MousePDay As Range
    
       
        Set MousePDay = Worksheets("Sheet1").Cells.Find(What:="Mouse/Day", LookIn:=xlFormulas, LookAt:=xlWhole, _
                           SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, _
                           SearchFormat:=False)
    Worksheets("Sheet2").Cells(1, "D").Value = MousePDay.Offset(, 1).Value
            
    
    End Sub
    Last edited by ashleys.nl; 09-14-2011 at 10:05 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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