use Excel VBA programming to draw a chair on a form
Steps
Open Excel and go to the Visual Basic Editor.
Insert the module.
Module programming. Programming in Module 1, declaring 4 functions, and writing a program that displays a form--"painting."
Insert the form.
Adjusts the size of the form. The Height proper
' Check public Function check () as Variant on Error GoTo erlb dim strdir as String st Rdir = Thisworkbook.worksheets ("Path"). Range ("B2") objfile = Dir (Strdir "\*.xlsx") thisworkbook.worksheets ("Result"). Activate with ActiveSheet . Range ("a2:b400"). Select '. Cells.select selection.clearcontents . Range ("A1"). Select end with application.screenupdating = False do while objfile icnt = 0 startrow = 9 with ActiveSheet for iRow = StartRow to MaxRow If Trim (ActiveSheet.Ce
-looking, but fortunately realized,,,, good luck.Figure three Adding controlsFigure Four Control propertiesSummaryBoss is want to let me realize, but, Minister incompetent Ah ~ The first day are looking at two level linkage menu, found that do not need VBA Ah, degree Niang said data validation can be realized, the next day reaction came over, need is multi-box, during debugging code when a face confused force, said I control undefined, later, the boss
(1) create a form in VBA, initialize its location, and call it...
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Sub CallForm ()UserForm1.Show 'display formUserForm1.Left = 600 'display positionUserForm1.Top = 180End SubPrivate Sub commandbutton#click ()CallForm 'callEnd Sub
(2) font color and background color of cells in Excel
Code
Code highlighti
1. Excel tools/macro/analysis tools/There are indeed similar functions in which the decimal number can be easily converted to binary. However, the fatal disadvantage of this function is that it can only be replaced.
-512 ~ An integer between 511 and beyond this range.
Therefore, we can only use VBA to write an available function.
2.2.alt + F11 orTool/macro/Visual Basic Editor/, Insert the module into the f
) " ":" "" 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 control's
Yesterday, one of my classmates lost their mobile phones, and all their phone numbers were lost. Therefore, I felt it necessary to back up the mobile phone numbers. So today I made an address book in Excel ----- VBA for one day. I will publish these codes tonight. Code writing is ugly. Due to time constraints. The Code has no comments. Please forgive me! The software has image descriptions!
===============
Although it is a very old technology, but when it comes to it, let's talk about it .....
Office EXCEL uses VBA to call WebService in two ways:
1. N years ago, Microsoft provided the mssoap30 component and compiled it for VC ++.. Net calls WebService in a similar way. They all add references, but the fatal defect is that 64-bit office is not supported.Program(Supports 32-bit office running on 64-bit mach
I. In thisworkbook
1 private sub workbook_open () 2' % corresponding to the Alt key macro cannot be added () 3 application. onkey "% Q", "test" 4 end sub
Trigger with open event
2. In sub
Sub auto_open () application. onkey "1", "test. Module 1. Test" End sub
Set the shortcut key to number 1 of the big keyboard part. In the macro, test is the name changed by vbaproject, Module name, and macro name.
Auto_open seems to be a fixed-name macro. The macro content with this name is automatically
In Excel VBA, variables can be divided into two categories: value type, such as integer and double. This type of variable assignment operation directly uses the equal sign. For example:
Dim A as integer
Dim B as integer
A = 12
B = a + 2
Another variable type is the object type, such as range and worksheet. This type of variable stores a pointer pointing to the actual object. The value assignment operat
, the regular expression can be written directly into the arguments of the formula, without having to be placed inside the cell and then referenced.FunctionRegexreplace (ByValText as String,ByValMatchpattern as String,ByValReplacePattern as String,Optional ByValIngorecase as Boolean=True) as String'by Jing He 2017-9-1DimRegex as NewRegExp withregex. Global=True . MultiLine=True . IgnoreCase=ingorecase. Pattern=MatchpatternEnd withIfRegex. Test (Text) ThenRegexreplace=Regex.Replace (Text,
ReDim statement to repeatedly change the elements of an array and the number of dimensions, but you cannot use ReDim to change an array to a different data type after you have defined it as a data type, unless it is an array contained in a Variant. If the array is indeed contained in a variant and does not use the Preserve keyword, you can use the AS type clause to change the type of its elements, but it is not allowed to change any data type in the case of using this keyword.If you use the Pre
From hereNumber-to-column label: Split (Cells (1,1). Address (1,0), "$") (0) ' Replace 1-256 with red 1 toCells (1, a) Select a cell in column A of the corresponding first row;The return value of address is the absolute address of the cell, such as $A$1, A column 1 row;It has 4 parameters, let's get straight to the front two, the first is the absolute path of the line, the default is true, the second is the absolute path of the column defaults to FalseA:cells (1, 1). Address () "$A $"B:cells (1,
I. Properties and Methods 1. Properties Click on the object above and the corresponding property is displayed below: 2. Methods Double-click the upper-left object to see the appropriate method: ii. Types of dataByte 0To255Boolean TrueOrFalseInteger- +,768To +,767Long(Long integer type)-2,147,483,648To2,147,483,647 Single(single-precision floating-point type)Double(double-precision floating-point type) CurrencyDecimal Date -Years1Month1Day to9999Years AMonth toDayObjec
default, and the fourth set of values (0,4096) Determines the mandatory return of a message box. When these numbers are added to generate buttons parameter values, only one number can be fetched from each set of values.
① These constants are specified by Visual Basic for Applications (VBA). As a result, you can use these constant names everywhere in your program code without having to use actual values. The actual value is equivalent to the constant
commands contained in strsql and save the results in the RS record set object
I = 1
Set sht = thisworkbook. worksheets ("sheet1") 'points the sht to the sheet 1 worksheet of the current workbook.
Do while not Rs. EOF 'when the Data Pointer is not moved to the end of the record set, the following operations are cyclically performed:
Sht. cells (I, 1) = RS ("Field 1") 'Save the value of field 1 of the current record to column 1st of row I of the sheet1
1, first we open a work sample table as an example.
2, the Copy method is the Excel worksheet Copy command, use the mouse to select cells or range cells, and then select the Copy command in the mouse mail panel, or use the CTRL + C key combination.
3, we use the ALT+F11 combination shortcut key into the VBE editor, insert a new module, and enter the following code in the module:
Option Explicit
Sub Cy ()
Sheets (1). Range ("A1"). Copy
End Su
Excel and VBAProgramDesign, latest news, expected to go public in September
1.Problem cause
When a prettyMmAsk you how to record and modify a macro and import her experiment data (dozens of data files) each time.ExcelYou said: "a lotExcelExperts will record a macro to solve the problem and modify it every time they use it.CodeAnd paste it to the desired place. For a qualified programmer, this is the most terrible thing ."
PrettyMmInterrup
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.