iTechtalk


If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.



Reply
Old 11-22-2008, 05:50 AM   #1 (permalink)
Junior Member
 
Join Date: Nov 2008
Posts: 7
Post Using With and End With When Referring to an Object

Using With and End With When Referring to an Object:-

In each subsequent line, you could leave off the name of the chart and begin the line with a period. You would end the block of code with an End With statement. This is faster to write than typing the complete object name multiple times, and it executes faster because Excel only has to figure out what WS.ChartObjects(“Chart1”) means once. The following code uses the With syntax while setting five properties:

Dim WS as Worksheet

Set WS = ThisWorkbook.Worksheets(“Income Statement”)

With WS.ChartObjects(“Chart1”)

.Chart.SetSourceData Source: = WS.Range(“A1:E4”)

.Left = 10

.Top = 30

.Width = 300

.Height = 200

End With
anode is offline   Reply With Quote
Reply

Bookmarks

Tags
an object, referring, with and end with

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:20 PM. itechtalk