indicates the absolute address of the file, and linenum indicates the row number. 3 function readfile2 (path, linenum) 4': handle the error, can be removed. If there is an error, it will automatically jump to the error tag and execute 5 on error goto Error 6 7' to open the file, and use the symbol "1" instead of the file stream 8 open path for input as #1 9 10' to determine whether the file stream "1" is read to the end of the file 11 do while not EOF (1) 12 13 'read a row in the file stream "1
Recently I made a small demo to automatically copy the Excel account data of each sales to the Excel account of the supervisor. The main code is as follows:
-------------------------------------------------------------
Sub copyfromsubfiles ()Dim myfile as stringDim Arr (1000) as string 'can process up to 1000 subaccountsDim count as integerDim currentpath as stri
The most by a friend set up a part-time operation of the company, but the need for some part-time staff pay, but due to a part-time wage between the 40~60, so the company adopted the principle is more than 200 to carry out, this rule is equivalent to drop the driver, the withdrawal needs more than 200, Then the problem came, in order to better let a large number of part-time staff can, clearly understand the time period in which they earn a lot of money, this time extended a problem, we need to
Sub CSV ()Dim Fs, MyFile as ObjectDim myfileline as String ' txtfile row dataDim Sht as WorksheetFor each sht in Thisworkbook.sheetsNS = Sht. Cells (1, 8)Set Fs = CreateObject ("Scripting.FileSystemObject") ' established FilesytemobjectSet myFile = fs.createtextfile (Activeworkbook.path + "\csv\" + ns + ". csv") ' Create a new TXT file with the same name as the XLS file by FileSystemObjectFor i = 2 to 1000RA = sht. Cells (i, 3)If ra = "Then Exit for"RB = ""For j = 3 to 1000CA = Sht. Cells (2, J)
value based on the row and column number specified in a given range (range reference or array) and returns a cell reference if the source data is a range, or a value in the array if the source range is an array.INDEX (Reference, Row_num, [Column_num], [Area_num])INDEX (Array, row_num, [column_num])Example: extracting from the data table on the left to create a new worksheetE4:index ($C $: $C $8, ROW (A2) *
used in Excel 8.0. This extended attribute is used in conjunction with the previous provider, and the different versions correspond to different provider. My environment is Excel2007 version, version number is 12.0, if directly changed to 12.0 will error, hint: Can not find the installable ISAM, the correct wording is: Cnnstr = "provider=microsoft.ace.oledb.12.0; Extended properties=excel 12.0;
Range (Rows (3), rows (5)). Insert Shift:=xldown1) Insert a row at the current cell ; You can add a loop statement to insert multiple rowsRange ("A10"). SelectSelection.EntireRow.Insert, Copyorigin:=xlformatfromleftorabove2) Insert the same number of rows at the current selection row as the number of rows to select, and change the line number to insert in different places. Rows ("10:11"). Select Selection.insert Shift:=xldown, Copyorigin:=xlformatfromleftorabove3) Change range to Sheet1.c
Write the Excel VBA tool to connect and manipulate the MySQL database.System environment:Os:win7 64-bit English versionOffice 2010 32-bit English version1, VBA before the preparation of the connection to MySQLTools--->references. ----> ReferencesTick Microsoft ActiveX Data Objects 2.8 Librarys and Microsoft ActiveX
$Sheets (1). Cells (Location (i), Beginrow). Interior.Color =vbred - End If - Next the - Exit FunctionWuyi End If the - Ifn = Arrmax Then Wu Exit Function - End If About $ forj = N toArrmax - IfJudge (j) =0 Then -Judge (j) =1 -Asum = Asum + arr (j,1) A PagerSubtest (J, Beginrow) + theJudge (j) =0 -Asum = Asum-arr (J,1) $ IfJ Then the whileArr (J,1) = Arr (j +1,1) thej = j +1 the Wend the
Store input data using a custom data type and display it through a popup window"Code Area"Type Lianxiren ' name as stringsex as Stringend typesub AA () Dim record as Lianxiren ' declare a lianxiren type variable record.name = Inpu Tbox ("Please enter name", "Record contact information") record. Sex = InputBox ("Please enter gender", "record Contact information") MsgBox "Name:" Record.name vblf "Gender:"
SubErrorHandler:If notXmlAttribute is Nothing Then SetXmlAttribute = Nothing End If If notXmlNode is Nothing Then SetXmlNode = Nothing End If If notXmlDoc is Nothing Then Setxmldoc = Nothing End If If notClsmosshelper is Nothing Then SetClsmosshelper = Nothing End Ifapplication.screenupdating=TrueApplication.DisplayAlerts=True MsgBoxErr.DescriptionEnd SubIV: Excel file.Ht
) " ":" "" Replace (MyRange (I, J), "" "", "" "" "" "" "If J
Recently in writing a Web page, need to query from the background of ASP Web pages to the MySQL recordset returned to the foreground ASP page, we know Ajax is not able to return from the background database recordset to the front page.
Looking at a lot of data, for the time being, it's a good choice to convert the recordset to a JSON-formatted stream, and then to import the Weboffice
Source: http://blog.csdn.net/alexbnlee/article/details/6923787
→ The Type statement is required for custom data types.
Type lianxiren name As String sex As String age As Integer phone As String address As String department As StringEnd TypeSub AddressList() Dim record As lianxiren record.name = "Alex" record.sex = "Male" record.age = 23 record.phone = "18812345678" record
interface type of the Excel VBA program 2589.1.2 select 259 for the interface type9.2 apply workbooks as interfaces 2609.3 custom menu and toolbar 2639.3.1 command bar object model 2639.3.2 commandbars set object 2649.3.3 commandbar object 2669.3.4 command bar control 2699.3.5 automatically create and delete Excel command bar 2819.4 user form 2829.4.1 design use
code written in Word documents or Excel workbooks is not managed.
Managed code has many advantages. The Common Language Runtime Library provided with the managed code verifies the code to avoid illegal operations, such as accessing memory that does not belong to it. Managed Code also allows you to access Microsoft. NET Framework and its base class libraries.
So why do we need to use unmanaged code? There are several reasons for choosing to continu
Label: style blog http OS use SP strong data Div The most common function of Excel is to record data and record data by row or column. This part of data is the source data, which is the most primitive flow account in business acti
should follow3.1 Grammar is the rule that should be followed when language is expressed3.1.1 Do not understand grammar, the expression will be wrong3.1.2 As a programming language, VBA also has syntax3.1.3 Don't worry, VBA syntax is not complicated3.2 Data and data types in
Recently, I have learned how powerful VBA is to modify an Excel report. This report was written by Daniel three years ago. Just open this file every day, the Dev and UAT databases in Oracle are automatically connected to read the latest market data and six perspectives are generated, compare the data similarities and d
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.