How to use the WITH … END WITH statement
The With ... End With statement allows you to write shorter code by referring to an object only once instead of using it with each property.
The picture above shows a macro that changes a few properties of the Range Object.
Statement Syntax
With object
[ code]
End With
The following macro changes the cells in cell range B2:B4 to bold, indents the text and changes the column width to 15.
Sub Macro1() With Range("B2:B4") .Font.Bold = True .InsertIndent 1 .ColumnWidth = 15 End With End Sub
Highlight row and column of selected cell
Today I would like to share with you these small event handler procedures that make it easier for you to […]
Extract cell references from a formula
I am trying to build a regular expression that matches cell references in a formula. A regular expression is a […]
Terry wants to make a different sized maze and I think that is a great idea. Perhaps you remember that I […]
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.
Contact Oscar
You can contact me through this contact form