Presentation is loading. Please wait.

Presentation is loading. Please wait.

OV 2 - 1 Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting.

Similar presentations


Presentation on theme: "OV 2 - 1 Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting."— Presentation transcript:

1 OV 2 - 1 Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting Worksheets Using Macros

2 OV 2 - 2 Copyright © 2011 Element K Content LLC. All rights reserved. The Selection Property Selection Property

3 OV 2 - 3 Copyright © 2011 Element K Content LLC. All rights reserved. The ActiveSheet Property ActiveSheet Property

4 OV 2 - 4 Copyright © 2011 Element K Content LLC. All rights reserved. The Name Property ActiveSheet.Name = “Conservative" New name of the worksheet New name of the worksheet Old name of the worksheet Old name of the worksheet Name property of the currently active worksheet

5 OV 2 - 5 Copyright © 2011 Element K Content LLC. All rights reserved. The Value Property Range(“A1”).Value = “Hello” A data value assigned to cell A1 A data value assigned to cell A1

6 OV 2 - 6 Copyright © 2011 Element K Content LLC. All rights reserved. Concatenation “Balanced” & “ ” & “Portfolio” “Balanced Portfolio” Concatenation operator Concatenation operator Pieces of text concatenated Single piece of text resulting from the concatenation Single piece of text resulting from the concatenation

7 OV 2 - 7 Copyright © 2011 Element K Content LLC. All rights reserved. The Range Object Range Object

8 OV 2 - 8 Copyright © 2011 Element K Content LLC. All rights reserved. The Select Method Range(“B6:E6”).Select Range object referring to a specific range Range object referring to a specific range Range selected on the worksheet Range selected on the worksheet

9 OV 2 - 9 Copyright © 2011 Element K Content LLC. All rights reserved. The CurrentRegion Property CurrentRegion Property

10 OV 2 - 10 Copyright © 2011 Element K Content LLC. All rights reserved. Data Types String Data Type Integer Data Type Boolean Data Type Classification of data used in a macro Text Positive or negative whole number Positive or negative whole number True/false value

11 OV 2 - 11 Copyright © 2011 Element K Content LLC. All rights reserved. Option Explicit Sub Variables Ex() Dim x As Integer Dim CustName As String Dim CurrentCust As Boolean x = 39 CustName = "John Smith" CurrentCust = False End Sub Variables Statement used to explicitly declare all variables Statements declaring variables in different data types Statements declaring variables in different data types Data assigned to variables Data assigned to variables

12 OV 2 - 12 Copyright © 2011 Element K Content LLC. All rights reserved. x = 39 + 5 y = x > 50 PrenCust = CurrentCust And PastCust Operators

13 OV 2 - 13 Copyright © 2011 Element K Content LLC. All rights reserved. For x = 1 To 12 Worksheets.Add After:=Worksheets(x) Next x The For Next Loop For statement Counter variable Code within the loop that is repeated Code within the loop that is repeated Next statement

14 OV 2 - 14 Copyright © 2011 Element K Content LLC. All rights reserved. Dim counter, factorial As Integer Counter = 10 Do factorial = factorial * counter counter = counter – 1 Loop While counter > 0 The Do Loop Do statement Code that gets executed each time Code that gets executed each time While criterion Loop statement

15 OV 2 - 15 Copyright © 2011 Element K Content LLC. All rights reserved. The Count Property Three sheets Worksheets.Count

16 OV 2 - 16 Copyright © 2011 Element K Content LLC. All rights reserved. The Offset Property ActiveCell.Offset(-3, -2) ActiveCell.Offset(3, 2) Column reference Positive values move offset down and right Positive values move offset down and right Negative values move offset up and left Negative values move offset up and left Row reference

17 OV 2 - 17 Copyright © 2011 Element K Content LLC. All rights reserved. The Copy Method ActiveSheet.Copy Data copied to the Clipboard Data copied to the Clipboard Copy method

18 OV 2 - 18 Copyright © 2011 Element K Content LLC. All rights reserved. The Paste Method ActiveSheet.Paste Paste method Data from the Clipboard pasted to the sheet

19 OV 2 - 19 Copyright © 2011 Element K Content LLC. All rights reserved. The Columns Property Columns(“B:E”).Select Column range specified within parentheses Columns property and Select method select a column

20 OV 2 - 20 Copyright © 2011 Element K Content LLC. All rights reserved. The AutoFit Method Columns(B:E).AutoFit AutoFit method

21 OV 2 - 21 Copyright © 2011 Element K Content LLC. All rights reserved. The Address Property ActiveCell.Value = ActiveCell.Address Address property

22 OV 2 - 22 Copyright © 2011 Element K Content LLC. All rights reserved. The Call Statement Sub MasterMac() Call InsertHeader Call FormatHeader Call InsertData Call FormatData End Sub Module containing component macros

23 OV 2 - 23 Copyright © 2011 Element K Content LLC. All rights reserved. The Font Property ActiveCell.Font.Name = “Old English MT” Font property

24 OV 2 - 24 Copyright © 2011 Element K Content LLC. All rights reserved. The End Property Range(“C50”).Select ActiveCell.End(x1Up) End property Direction of the last cell

25 OV 2 - 25 Copyright © 2011 Element K Content LLC. All rights reserved. 1. Which manual formatting tasks will you want to replace with a macro? 2. Which coding technique will you use often when creating macros for formatting data? Reflective Questions


Download ppt "OV 2 - 1 Copyright © 2011 Element K Content LLC. All rights reserved.  Insert Text  Format Text  Sort Data  Duplicate Data  Generate a Report Formatting."

Similar presentations


Ads by Google