Home > Software engineering >  C OLE way reading Excel (Range: : Find how to use)
C OLE way reading Excel (Range: : Find how to use)

Time:09-17

Vba find lookup table in the biggest rectangle is not null, according to the code below:
Sub viewing area ()
% % % Dim a, b, m, n %
A=Cells. The Find (" * ",,, 1, 1, 1), the row
B=Cells. The Find (" * ",,, 1, 2, 1). The column
M=Cells. The Find (" * ",,, 1, 1, 2). The row
N=Cells. The Find (" * ",,, 1, 2, 2). The column
Range (Cells (a, b), Cells (m, n)). Select
End Sub

But COM Find statement is as follows:
LPDISPATCH Find (const VARIANT& What, const VARIANT& After, const VARIANT& LookIn, const VARIANT& LookAt, const VARIANT& SearchOrder, long SearchDirection, const VARIANT& MatchCase, const VARIANT& MatchByte, const VARIANT& SearchFormat);
How should to achieve the above effect of VBA code?
The following parameters represent what meaning? How should preach to participate?

So ask:
After parameter function is what
LookIn, this is where to find?
LookAt, this is where to find?
SearchOrder, specify what to find order?
Long SearchDirection, specify what to find direction?
MatchCase, this is the match?
MatchByte, this is the match? All characters matching
SearchFormat find format should be how to set the
Please advice! Thank you very much!!!!!

CodePudding user response:

Open the excle program, enter the VBA editing interface (recording a macro, then edit the macro)
Click help, search,

Range. Find methods
In the area to find specific information,
Syntax

Expression. The Find (I, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)

Expression of a representative Range object variables,

Parameter

Name shall be selected/optional data type description
I will choose the Variant will search data, can be a string or any Microsoft Excel data types,
After an optional Variant said search process will begin After the cell, the cell corresponds to the search from the user interface when the activities of the cell, please note that After must be in the area of a single cell, keep in mind that the search begins After the cell; Until back to this cell, this method is to search, if you do not specify this parameter, the search will begin from the area of the upper left corner of the cell,
LookIn optional Variant information types,
LookAt optional Variant can be one of the following XlLookAt constants: xlWhole or xlPart,
SearchOrder optional Variant can be one of the following XlSearchOrder constants: xlByRows or xlByColumns,
SearchDirection optional XlSearchDirection search direction,
MatchCase optional Variant if is True, the search is case sensitive, the default value is False,
MatchByte optional Variant only in has chosen or installed double-byte languages support when applicable, if it is True, then double-byte characters with double-byte characters, only if it is False, the double byte characters can be matching their equivalence of single-byte characters,
SearchFormat optional Variant search format,

CodePudding user response:

# import way of introducing Excel, the remaining and VBA macro code is very close to

  • Related