'<<<<<<Function to get the column number From Excel sheet for a paricular text>>>>
'**********************************************************************************************************
'Function Name: funGetColumnNumberInExcel(ip_objWorksheet, ip_strExpectedColumnName, ip_intRowNumber, ip_intStartColumnNumberIndex, ip_blnIsRelativeComparison)
'Description : Used to get the column number from the Excel sheet in particular row from particular column number
'Parameters: ip_objWorksheet: Create an object for the Excel sheet
'ip_strExpectedColumnName: Need to enter the particular text which to you get the column number
'ip_intRowNumber: In which row you want to start the search for the partiuclar text
'ip_intStartColumnNumberIndex= From which column you need to start the searching for the particular text
'ip_blnIsRelativeComparison= need to compare the full exact text or partival text, need to send the parameter as True or Fasle
'Return value Number: Returns the column number of the particular text
'Example: funGetColumnNumberInExcel(objWorksheet, "Max", 4, intColumnNumber, False)
'**********************************************************************************************************
'<<<<<<Function to get the column number from the Excel sheet for a paricular text>>>>
Function funGetColumnNumberInExcel(ip_objWorksheet, ip_strExpectedColumnName, ip_intRowNumber, ip_intStartColumnNumberIndex, ip_blnIsRelativeComparison)
'<<< Default Return value is set as empty >>>
funGetColumnNumberInExcel = ""
Dim strActualColumnName, intTotalColumnCount, intColumnStartIndex
Wait 4
intTotalColumnCount = ip_objWorksheet.UsedRange.Columns.Count
'<<< Extract the cell value from given row number starting from the mentioned start index for column >>>
For intColumnStartIndex = ip_intStartColumnNumberIndex To intTotalColumnCount
strActualColumnName = ip_objWorksheet.Cells(ip_intRowNumber, intColumnStartIndex).Value
'<<< Using Instr function for relative comparison based upon the flag value passed >>>
If ip_blnIsRelativeComparison = True Then
If Instr(UCase(Trim(strActualColumnName)),UCase(Trim(ip_strExpectedColumnName))) Then
funGetColumnNumberInExcel = intColumnStartIndex
Exit Function
End If
Else
If UCase(Trim(strActualColumnName)) = UCase(Trim(ip_strExpectedColumnName)) Then
funGetColumnNumberInExcel = intColumnStartIndex
Exit Function
End If
End If
Next
End Function
'<<<<<<Function to get the Row number from the Excel sheet of a paricular text>>>>
'**********************************************************************************************************
'Function Name: funGetRowNumberInExcel(ip_objWorksheet, ip_strExpectedRowValue, ip_intColumnNumber, ip_intStartRowNumberIndex, ip_blnIsRelativeComparison)
'Description : Used to get the Row number from the Excel sheet in particular Column from particular Row number
'Parameters: ip_objWorksheet: Create an object for the Excel sheet
'ip_strExpectedRowValue: Need to enter the particular text which to you get the Row number
'ip_intColumnNumber: In which Column you want to start the search for the partiuclar text
'ip_intStartRowNumberIndex= From which Row you need to start the searching for the particular text
'ip_blnIsRelativeComparison= need to compare the full exact text or partival text, need to send the parameter as True or Fasle
'Return value Number: Returns the Row number of the particular text
'Example: funGetRowNumberInExcel(objWorksheet, "Chain Total", intStoreColumnNumber,1, True)
'**********************************************************************************************************
Function funGetRowNumberInExcel(ip_objWorksheet, ip_strExpectedRowValue, ip_intColumnNumber, ip_intStartRowNumberIndex, ip_blnIsRelativeComparison)
'<<< Default Return value is set as empty >>>
funGetRowNumberInExcel = ""
Dim strActualRowValue, intTotalRowCount, intRowStartIndex
Wait 4
intTotalRowCount = ip_objWorksheet.UsedRange.Rows.Count
'<<< Extract the cell value from given row number starting from the mentioned start index for column >>>
For intRowStartIndex = ip_intStartRowNumberIndex To intTotalRowCount
strActualRowValue = ip_objWorksheet.Cells(intRowStartIndex, ip_intColumnNumber).Value
'<<< Using Instr function for relative comparison based upon the flag value passed >>>
If ip_blnIsRelativeComparison = True Then
If Instr(UCase(Trim(strActualRowValue)),UCase(Trim(ip_strExpectedRowValue))) Then
funGetRowNumberInExcel = intRowStartIndex
Exit Function
End If
Else
If UCase(Trim(strActualRowValue)) = UCase(Trim(ip_strExpectedRowValue)) Then
funGetRowNumberInExcel = intRowStartIndex
Exit Function
End If
End If
Next
End Function
'**********************************************************************************************************
'Function Name: funGetColumnNumberInExcel(ip_objWorksheet, ip_strExpectedColumnName, ip_intRowNumber, ip_intStartColumnNumberIndex, ip_blnIsRelativeComparison)
'Description : Used to get the column number from the Excel sheet in particular row from particular column number
'Parameters: ip_objWorksheet: Create an object for the Excel sheet
'ip_strExpectedColumnName: Need to enter the particular text which to you get the column number
'ip_intRowNumber: In which row you want to start the search for the partiuclar text
'ip_intStartColumnNumberIndex= From which column you need to start the searching for the particular text
'ip_blnIsRelativeComparison= need to compare the full exact text or partival text, need to send the parameter as True or Fasle
'Return value Number: Returns the column number of the particular text
'Example: funGetColumnNumberInExcel(objWorksheet, "Max", 4, intColumnNumber, False)
'**********************************************************************************************************
'<<<<<<Function to get the column number from the Excel sheet for a paricular text>>>>
Function funGetColumnNumberInExcel(ip_objWorksheet, ip_strExpectedColumnName, ip_intRowNumber, ip_intStartColumnNumberIndex, ip_blnIsRelativeComparison)
'<<< Default Return value is set as empty >>>
funGetColumnNumberInExcel = ""
Dim strActualColumnName, intTotalColumnCount, intColumnStartIndex
Wait 4
intTotalColumnCount = ip_objWorksheet.UsedRange.Columns.Count
'<<< Extract the cell value from given row number starting from the mentioned start index for column >>>
For intColumnStartIndex = ip_intStartColumnNumberIndex To intTotalColumnCount
strActualColumnName = ip_objWorksheet.Cells(ip_intRowNumber, intColumnStartIndex).Value
'<<< Using Instr function for relative comparison based upon the flag value passed >>>
If ip_blnIsRelativeComparison = True Then
If Instr(UCase(Trim(strActualColumnName)),UCase(Trim(ip_strExpectedColumnName))) Then
funGetColumnNumberInExcel = intColumnStartIndex
Exit Function
End If
Else
If UCase(Trim(strActualColumnName)) = UCase(Trim(ip_strExpectedColumnName)) Then
funGetColumnNumberInExcel = intColumnStartIndex
Exit Function
End If
End If
Next
End Function
'<<<<<<Function to get the Row number from the Excel sheet of a paricular text>>>>
'**********************************************************************************************************
'Function Name: funGetRowNumberInExcel(ip_objWorksheet, ip_strExpectedRowValue, ip_intColumnNumber, ip_intStartRowNumberIndex, ip_blnIsRelativeComparison)
'Description : Used to get the Row number from the Excel sheet in particular Column from particular Row number
'Parameters: ip_objWorksheet: Create an object for the Excel sheet
'ip_strExpectedRowValue: Need to enter the particular text which to you get the Row number
'ip_intColumnNumber: In which Column you want to start the search for the partiuclar text
'ip_intStartRowNumberIndex= From which Row you need to start the searching for the particular text
'ip_blnIsRelativeComparison= need to compare the full exact text or partival text, need to send the parameter as True or Fasle
'Return value Number: Returns the Row number of the particular text
'Example: funGetRowNumberInExcel(objWorksheet, "Chain Total", intStoreColumnNumber,1, True)
'**********************************************************************************************************
Function funGetRowNumberInExcel(ip_objWorksheet, ip_strExpectedRowValue, ip_intColumnNumber, ip_intStartRowNumberIndex, ip_blnIsRelativeComparison)
'<<< Default Return value is set as empty >>>
funGetRowNumberInExcel = ""
Dim strActualRowValue, intTotalRowCount, intRowStartIndex
Wait 4
intTotalRowCount = ip_objWorksheet.UsedRange.Rows.Count
'<<< Extract the cell value from given row number starting from the mentioned start index for column >>>
For intRowStartIndex = ip_intStartRowNumberIndex To intTotalRowCount
strActualRowValue = ip_objWorksheet.Cells(intRowStartIndex, ip_intColumnNumber).Value
'<<< Using Instr function for relative comparison based upon the flag value passed >>>
If ip_blnIsRelativeComparison = True Then
If Instr(UCase(Trim(strActualRowValue)),UCase(Trim(ip_strExpectedRowValue))) Then
funGetRowNumberInExcel = intRowStartIndex
Exit Function
End If
Else
If UCase(Trim(strActualRowValue)) = UCase(Trim(ip_strExpectedRowValue)) Then
funGetRowNumberInExcel = intRowStartIndex
Exit Function
End If
End If
Next
End Function
No comments:
Post a Comment