Grab the Free VBA Quick Reference Guide
[ Ссылка ]
When you start coding you will run into the With Statement when recording macros. In this video, we break the With End With Statement down so it makes sense.
There are times where the with Statement is perfect and there are other times where is simply additional lines of code that isn't needed.
CODE:
=======================
Sub WithWhat()
'
' WithWhat Macro
' This will be commented out
'
'
Range("F4:H9").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
' Selection.Interior.Pattern = xlSolid
' Selection.Interior.PatternColorIndex = xlAutomatic
Selection.Interior.ThemeColor = xlThemeColorLight1
With Range.Interior
End With
Range("G13:I16").Select
With Selection.Font
.Color = -16776961
.Bold = True
.Underline = True
End With
End Sub
Excel VBA With Statement Intro
Теги
vba with statement rangevba with statement excelexcel with end with vbavba with statement examplesvba with statement syntaxexcel vba with end with statementwith end with statement vbawith end with vba codevba with end with functionexcel vba with statementvba with statementwith end with vbawith end with vba excelmacros end withmacro excel with end withvbaexceleverydayvbavba with excelexcel VBA with