Option Explicit
Dim objExcel,objSheet,oDic,strSQL,ProcColl,oWMIService
Dim intRow,intColumn
Dim i,j,k
Dim strVal
GetExcelValue("Gouri")
Public Function GetExcelValue(byRef strVal)
Set oDic = CreateObject("Scripting.dictionary")
Set objExcel = CreateObject("Excel.Application")
ObjExcel.workbooks.open("D:\example.xls")
Set objSheet = objExcel.ActiveWorkbook.Worksheets("Data")
objExcel.Sheets("Data").usedrange.select
intRow = objExcel.Selection.rows.count
intColumn = objExcel.Selection.columns.count
For i = 1 to intRow
If objSheet.cells(i,1).value = strVal Then
msgbox i
For j = 2 to intColumn
If trim(objSheet.cells(i,j).value) <> "" Then
oDic.Add objSheet.cells(i,j).value,objSheet.cells(i+1,j).value
msgbox oDic.Item(objSheet.cells(i,j).value)
End If
Next
End If
Next
Fun_KillExcel()
End Function