You are on page 1of 2

Hides all worksheets, but the welcome sheet, when the application is opened.

Private Sub Workbook_Open () --- Worksheets(Welcome).Visible = True --- Worksheets(Input).Visible = False --Worksheets(Analysis).Visible = False --ColorIndex; value = numerical color index (3 = red 5 = blue 6 = yellow 4 = green) --Color; value = VB Constant or RGB Function (vbRed, vbBlue, vbYellow, vbGreen) --Range(A1:F12).Interior.ColorIndex = 3 --- Range(A1:F12).Interior.Color = vbRed --Font. Bold; value = True or False Size; value = number Color; value = VB Constant, RGB Function ColorIndex; value = number FontStyle; value = style ------ Clear = clears everything ClearContents = clears values or formulas only ClearFormats = clears formats only Application. ScreenUpdating; value = True, False CutCopyMode; value = True, False Wait; arguments = Now, TimeValue The With construct With Range(A1:C8) Interior.Color = vbRed ---- .Font.Bold = True ---- .Font.Name = Arial Offset & Cells --- Range(A3).Offset (0, 10).Interior.ColorIndex = 15 or Range(A3).Cells(1, 5).Interior.ColorIndex = 15 Colum & Rows --- Range(B3:K9).Columns(3).Interior.ColorIndex = 5 ---Range(B3:K9).Rows(2).Font.Color = vbRed Entire Column --- Range(B3:K9).EntireColumn.HorizontalAlignment = xlLeft End --- Range(A3, Range(A3).Row(xlDown)).Copy --- Range(A12).PasteSpecial Name --- Range(Range(A3), Range(A3).End(xlToRight)).Name = Passengers Range(Passengers).BorderAround Weight:=xlThick Autofill --- Range(M6).AutoFill Destination:=Range(M6:M9), Type:= xlFillDefault Max, Min, Average, Sum, Count, VLookup --- Range(A12).Value = Application.Worksheet.Function.Max(Range(B6:K6)) The ScreenUpdating property helps the code run more efficiently since the Excel screen does not need to be updated after every action in the code. The CutCopyMode property prevents a flashing box from remaining around the range which has been copied after a macro has been run. Wait pauses the macro while it is being run until a specified time is reached. The Now argument calculates the current time and the TimeValue argument gives an integer-valued time amount to add to the current time. The With construct is basically used to set several properties of one object in an enclosed statement. End is a very useful property as it can help you find the end of row or column of any range of data. We also use the AutoFill method to copy and paste formulas and The Application object uses the WorksheetFunction property to set a function for a cell or range of cells. The ActiveChart object will be used to set all other chart parameters and formatting. You can use the Drawing Toolbar to help you draw a variety of shapes on the spreadsheet.

You might also like