this code will run from outlook
i am unable to find first non yellow/Colored cell in excel, some its works and some time its given me wrong cell.
Code: Select all
Sub CopyNonYellow()
Dim excelApp As Object
Dim excelWorkbook As Object
Dim excelWorksheet As Object
Dim rangeToCopy As Object
Dim nonYellowCell As Object
Set excelApp = GetObject(, "Excel.Application")
Set excelWorkbook = excelApp.Workbooks("SFA.xlsm")
Set excelWorksheet = excelWorkbook.Worksheets("FOC Number")
'numRows = InputBox("How many numbers do you want?", "Number of Rows") - 1
' Find the first non-yellow cell
Set nonYellowCell = excelWorksheet.Range("A2:A100000").Find(What:="", LookIn:=xlValues, LookAt:=xlWhole, searchformat:=True)
MsgBox nonYellowCell.Row