Follow @dporton

JustCode : Find first cell with specific content

This function will find the first cell of the active worksheet with a specific content and return the column or row number.

' ****************************************
' Designed by : Smarter Dimensions
' Last Updated : 5th July 2009
' Function to find first cell with specific content
' ****************************************

Dim oExcel,oWorkBook,oSheet
dim iCel,oCell,iStartCol,iEndCol

Set oExcel = createobject("Excel.Application")


oExcel.Visible = True

oWorkBook = oExcel.ActiveWorkbook

Set oSheet = oWorkBook.ActiveSheet

iStartCol = 1
iEndCol = FindFirstCell(3,9,"C","",oSheet)

Function FindFirstCell(iCol,iRow,sDirection,sLookFor,oSheet)

     Do while oSheet.Cells[iRow][iCol].text <> sLookFor
         Select Case sDirection
             Case = "C"
                 iCol = iCol + 1
             Case = "R"
                 iRow = iRow + 1
        End Select

     Select Case sDirection
         Case = "C"
             FindFirstCell = iCol - 1
         Case = "R"
             FindFirstCell = iRow - 1
     End Select

End Function

Site Under Renovation


just to let you know that this site is undergoing some re-work. The site should be up at all times and you should be able to get to the content that you need.

Things to do :

  1. Choose a new theme.
  2. Make sure links work.
  3. Will be deleting all user accounts shortly due to spam users.
  4. Will be deleting all old job post.

I am also looking for content writers so if you are interested in writing articles for this site let me know and lets see if we can make something happen.

Hope you find what you need.


%d bloggers like this: