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
Bookmarks