Jump to content

_Excel_RangeFind '$iLookIn' Parameter - examples


l3ill
 Share

Recommended Posts

Cheers,

Hit a snag automating some excel stuff and I think this parameter could be what I need. Unfortunately cant find any examples/instructions on how to use it.

A shove in the right direction would be greatly appreciated. ;)

$iLookIn    [optional] Specifies where to search. Can be any of the XLFindLookIn enumeration (default = $xlValues)

Bill

Link to comment
Share on other sites

If you look at the Excel Constants it says:

Quote


; XlFindLookIn Enumeration. Specifies the type of data to search.
; See: http://msdn.microsoft.com/en-us/library/ff822180(v=office.14).aspx
Global Const $xlComments = -4144 ; Comments
Global Const $xlFormulas = -4123 ; Formulas
Global Const $xlValues = -4163 ; Values

Edit: what are you looking for?  Maybe some more info on the problem?

Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

But what are you then looking for?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I was hoping for a parameter that would limit the search range,  for instance as a variable given from a previously found range.

I have a large excel sheet (made from a  PDF) with financial statements with information that will always be in a different row.

I need to search for a Facility and in that facility search for several different titles; sales, dop, income, depreciation...  and then grab cell info (numbers).

So basically limit the search range for the titles to whatever area of the worksheet  "name your Facility" is filling. The 'facility area' was the variable I was hoping to pass on to the range_find as a variable to search for those titles in each facility , one facility at a time.

Hope that makes sense...

Thanks for your interest :) 

 

 

Link to comment
Share on other sites

Can you please post an (anonymized) sample of your data? Maybe setting a filter is all you need?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Just an FYI,

I ended up finding a way to get this done:

I had to set it up to find the first occurrence (there are 3) of the name of the first fac. and the first occurrence of the second fac. (-1)

Which gives me the chunk I was needing to pass on as a search criteria for the next section of code.

Spoiler
#Region  ; separates the facities in chunks for next step ($sFacRange) = A102:M196)=====working !!!

For $i = 0 To 10 ; loop through facilties
    ConsoleWrite("$aFacName[$i] = " & $aFacName[$i] & @CRLF)
;~  ConsoleWrite("$i) = " & $i & @CRLF)
    Local $aFacRange_First = _Excel_RangeFind($srcWorkbook, $aFacName[$i]) ; Find all cases of Fac (usually 3 for 3 pages)
    If $i <= 9 Then
    Local $aFacRange_Second = _Excel_RangeFind($srcWorkbook, $aFacName[$i + 1])
    Else
    ExitLoop
    EndIf

    Local $sInt01 = StringTrimLeft($aFacRange_First[0][2], 3) ;removes leading $A$ - leaving just number
    Local $aFacRange_First = "A" & $sInt01
    Local $sInt02 = StringTrimLeft($aFacRange_Second[0][2], 3) ;removes leading $A$ - leaving just number
    Local $sInt_02 = $sInt02 - 1
    Local $aFacRange_Second = "M" & $sInt_02
    Local $sFacRange = $aFacRange_First & ":" & $aFacRange_Second
    ConsoleWrite("$sFacRange) = " & $sFacRange & @CRLF)
#EndRegion ; separates the facities in chunks for next step ($sFacRange) = A102:M196)===working !!!

Next ; is further down in the code,  added for testing obviously wouldnt work w/out this ;-)

 

Excel file: imagine a large financial statement with 10 fac. each fac. has 3 sections.

every month they are in different cells with empty cells added randomly. (tons of empty or useless information cells)

 

Thanks again :)

Bill

 

Edit: An example of the console output:

Spoiler
$aFacName[$i] = Fac. 01
$i) = 0
$sFacRange) = A102:M196
$aFacName[$i] = Fac. 02
$i) = 1
$sFacRange) = A197:M287
$aFacName[$i] = Fac. 03
$i) = 2
$sFacRange) = A288:M370

 

 

Edited by l3ill
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...