Wednesday, December 12, 2012

How to Get Started With Excel VBA


Record a Macro
1. If you have ever recorded a macro, you are already using VBA. The Visual Basic editor translates your keystrokes into VBA commands. The resulting code is inefficient, but it can help you get familiar with VBA syntax and commands.
2. In Excel, record a simple macro. In Office XP, select Macro, Record New Macro from the Tools menu. (In Excel 2007, commands are on the Developer tab.) Change the macro name or leave the default, and press OK.
3. With the macro recorder running, type 'Hello World' in cell A1. Apply Bold, Italic, and Underline, and change the font color to red. Double-click on the column separator in the header row, between columns A and B, to resize the cell's width to its contents.
4. Turn off the macro recorder by selecting Tools, Macro, Stop Recording.
5. Test the macro to make sure the message appears.
Examine Recorded Code
6. Right-click on the Sheet1 tab and select View Code, or press Alt-F11, to open the VB editor, and double-click on Module 1. Your macro code will look something like this:Sub Macro1()ActiveCell.FormulaR1C1 = 'Hello World'
Range('A1').Select
Selection.Font.Bold = True
Selection.Font.Italic = True
Selection.Font.Underline = xlUnderlineStyleSingle
Columns('A:A').EntireColumn.AutoFit
Selection.Font.ColorIndex = 3End Sub
7. Note that the macro begins with 'Sub' and ends with 'End Sub.' Every VBA subroutine begins and ends this way.
8. Find familiar keywords. Since you know what this macro does, you can figure out that 'Selection.Font.Bold=True' changes the selection to bold font. You can also recognize the commands to resize the column and change the color.
9. Go back to Excel and try recording a few more simple macros, each time examining the code in the VB editor.
Set Up the VB Editor
10. Launch the VB editor by pressing Alt-F11.
11. Click on each menu item across the top to familiarize yourself with available options.
12. Set up your environment with options from the View menu. At a minimum, add the Properties Window and the Project Explorer. You can dock them to the left side of the screen by right-clicking and selecting 'Dockable.'
13. Try the context-sensitive Help feature at any time by pressing F1.
Design a Form
14. From the Insert menu, select Insert UserForm. The UserForm is your design canvas.
15. If the UserForm doesn't pop up, go to the Project Editor and double-click 'Forms,' then double-click UserForm1.
16. When the UserForm appears, you will also see the Toolbox, which contains controls you will use in creating your forms. For instance, you can include buttons, text boxes, drop-downs and labels. Hover your cursor over each to see the names.
17. Add some controls to your form. To add a text box, find it in the Tool Box, click on it, then move your cursor to the User Form and draw a rectangle on the form. You will see a shape that looks something like a window. This is where the user will enter his input.
18. Place more controls on the form. Experiment with resizing and rearranging. For some controls to work, they need to be programmed. For instance, an 'OK' button needs an associated sequence of actions. Other controls, like labels, usually need little, if any, programming.
Program a Message Box
19. The 'MsgBox' is preset; you will not need to design a form. But you will need some code. You can program 'Yes,' 'No,' 'OK' and 'Cancel' buttons, configure the prompt, and more.
20. This message box will warn the user that the file will close without saving when she clicks 'Yes.' If she clicks 'No,' the file will save before closing. If she selects 'Cancel,' the file will not close.
21. Launch the VB editor. From the Insert menu, insert a module; then, in the Project Explorer, double-click the new module. A code window will open up.
22. Type the following routine. (Do not type the text in the brackets that follow.)
Sub MsgBoxTest() [Subroutines always begin with Sub and end with End Sub]
myTitle = 'Warning' [Assigns a value to 'myTitle.' When you use 'myTitle' later, it's the same as typing 'Warning.']
myMsg = 'Close without saving? All changes will be lost.' [Assigns a value to 'MyMsg.']
Response = MsgBox(myMsg, vbExclamation vbYesNoCancel, myTitle) [Defines the message box. It will contain 'myMsg,' a warning exclamation point, and Yes, No and Cancel buttons, and the title bar will read 'Warning,' because that's the value of 'myTitle.']
Select Case Response [Select Case assigns actions to various options.]
Case Is = vbYes [If the user clicks Yes]
ActiveWorkbook.Close SaveChanges:=False [Close without saving.]
Case Is = vbNo [If the user clicks No]
ActiveWorkbook.Close SaveChanges:=True [Save and close.]
Case Is = vbCancel [If the user clicks Cancel]
Exit Sub [Exit the subroutine. Don't do anything.]
End Select [This ends the Select Case statement.]
End Sub [Ends the subroutine]
23. Select Run, Run Sub/User Form from the menu. Your message box will be displayed; you have now successfully written a functioning VBA routine.
Read more ►

Tuesday, December 11, 2012

How to Create Multiple Graphs in One Chart


1. Open your spreadsheet program and enter your two data sets into adjacent columns. Type a label for your data sets in the first row of each column. (Note: These instructions are based on Open Office Calc, a free spreadsheet program, but the process will be similar when using Microsoft Excel.)
2. Click and drag to select all of the cells whose data you wish to include in your chart, including the 'label' cells at the top of each column.
3. Click 'Insert' and then 'Chart.' Select 'Line' from the 'Choose a chart type' column. Select 'Lines and Points' from the icons on the right-hand side of the dialog box. Click 'Next.' Make sure the 'First row as label' box is checked and then 'Next' twice.
4. Type in a title for your chart, a subtitle (if desired) and names for the X axis and Y axis. Click 'Finish.'
Read more ►

How to Create a 4 Axis Chart in Excel


1. Create a new spreadsheet in Excel.
2. Type the label names of your axes in each column, for example, Axis 01, Axis 02, Axis 03, and Axis 04 as headers in columns A, B, C, and D respectively.
3. Type the corresponding data for each column and row. The row data will be the “Series” plotted against the actual axis of each column.
4. Highlight the entire set of rows and columns by dragging the mouse cursor across the axis and data fields while holding the left mouse button down.
5. Click “Insert,' 'Charts,' then 'Other Charts' and choose a 'Radar' option from the main menu.
Read more ►

How to Print Odd Even Pages in Excel 2007


1. Click on the 'Developer' tab in Excel 2007.
2. Click on 'Visual Basic' to open the Visual Basic Editor (VBE).
3. Click 'Insert,' then 'Module' to open a blank module window.
4. Copy and paste the following code into the module window:Sub PrintOddEven()Dim TotalPages As LongDim StartPage As LongDim Page As IntegerStartPage = InputBox('Enter starting page number')TotalPages = Application.ExecuteExcel4Macro('GET.DOCUMENT(50)')If StartPage > 0 And StartPage
5. Press 'F5' to run the macro. A pop-up window will appear and you will be returned to the Excel spreadsheet.
6. Type the starting page number in the textbox. If you want to print odd pages, enter an odd number. If you want to print even pages, enter an even number. Excel will print odd or even pages from that starting point. For example, if you type '1,' Excel will print odd pages 1 through the end of your document.
Read more ►

How to Make a 2 Column List in an Excel Spreadsheet


1. Open Microsoft Excel 2007 on your computer. As you can see, several columns and rows already come up in Excel.
2. Place a title at the top of the spreadsheet. This is very important so that you know what is actually listed in the spreadsheet. Place the title at the very top of the page, starting in cell A1.
3. Add titles to the two columns that will compose the list. Place the column titles a few lines down from the title of the spreadsheet. This will help you remember what information is in each column. Center the columns by highlighting both cells and click on the centering icon (showing centered text) in the 'Alignment' section of the 'Home' tab.
4. Bold the title of the spreadsheet and the titles of the columns. Highlight the cells to be bolded and click on the bold icon in the 'Font' section of the 'Home' tab.
5. Skip a line after the column titles and enter your data into columns A and B. You can enter text or numbers, depending on the purpose of the two-column list.
6. Format any numbers that you have entered. If you entered dates, monetary amounts or regular numbers in the columns, you can format them so that all of the numbers look the same. To do this, highlight all of the cells with numbers that you want to format in the same way. Right click and select 'Format Cells.' Use the tools in the 'Number' tab to format the cells according to your purpose.
7. Create totals for columns with numbers, if needed. To do this, click on the cell where you want the total to be, and then click on the sigma symbol (it kind of looks like an E) in the 'Editing' section of the 'Home' tab. The following will appear in the cell: =SUM(). Click on the first cell that you want included in the total, and drag down to highlight the last cell to include in the total. Press 'Enter' and the total will be inserted.
Read more ►

Wednesday, November 28, 2012

How to Delete a Macro Computer Virus


1. Run the program that the infecting macro was originally opened with, such as Microsoft Word or Excel, by double-clicking on its appropriate desktop icon.
2.
Click on the 'View' tab at the top of the screen. Scroll all the way over to the far right side of the screen and click on the button labeled 'Macros.' Click on 'View Macros' on the drop-down menu that will pop up underneath the Macro button.
3.
Wait for the new window to pop up and then scroll through the list of macros installed until you find the one that infected your computer. Click on the name of the macro and then click on the button that is labeled 'Delete.'
4. Close the 'View Macro' window and then click on the large, circular Microsoft icon at the top left of the screen. Click on the option that says the name of the program followed by 'Options,' such as 'Excel Options.' Click on 'Trust Center' and then click the button that says 'Trust Center Options.' Click the option marked as 'Macro' settings and then click the radio button next to the option that says 'Disable all macros.'
5. Open your web browser and navigate to a website that offers a virus scanning program such as AVG Free (see Resources below). Download the installation file and then open the folder where you saved the file. Double-click on it and follow the on-screen instructions to install the program. Open the software by double-clicking on its desktop icon and then click on the option to run a full system scan. Wait for the scan to finish and then click on the option to delete any virus threats found.
Read more ►

How to Format Rows and Columns in Excel 2003


1. Open your Excel worksheet and select the rows or columns you want to format. To select, hold down the left mouse button and drag.
2. Click 'Format' on the top menu bar to summon a list of options for formatting your worksheet.
3. Click either 'Row' or 'Column.' The rows are horizontal, the columns are vertical.
4. If you click 'Row,' a box will appear. Enter the row height. If you pick 'Column,' enter the column's width in the designated box.
5. When you've finished formatting, click 'OK' and save your work.
Read more ►

Tuesday, November 27, 2012

How to Restore Microsoft Excel to Its Default Spreadsheet


Excel 2003 or Earlier
1. Go to \'C:\\Documents and Settings\\
\\Application Data\\Microsoft\\Templates.\' Open \'My Computer\' and open the \'Documents and Settings\' folder. Open your username, then \'Application Data,\' \'Microsoft\' and finally find the \'Templates\' folder.
2. Rename the Book.xlt and Sheet.xlt files to something that you will remember. This step is optional, but allows you to save the settings for later use. Either move these files, or delete them if you don't want to use the template again. If there are no XLT files in this folder, continue below.
3. Go to \'C:\\Program Files\\Microsoft Office\\Office11\\XLStart.\' Navigate to \'Program Files,\' and open the \'Microsoft Office\' directory. Select \'Office11\' and then \'XLStart.\'
4. Look for any template files inside this folder--these are any files with a \'.xlt\' extension. If there are any, delete them. If there are none, continue below.
5. Open Microsoft Excel, and locate the \'Options\' settings under the \'Tools\' menu.
6. Click the \'General\' tab and note which folder is listed \'At Startup, open all files in.\' Minimize or close Excel and navigate to the folder listed in that box.
7. Delete any existing XLT files in that folder. If you want to save them for later use, rename the template using a name you will remember.
8. Open, or close and reopen Microsoft Excel to verify the settings returned to default.
Excel 2007 or Later
9. Open Microsoft Excel.
10. Navigate to the Help menu and open the \'Detect and Repair\' function. The Detect and Repair dialog will appear. If you want to restore your shortcuts at this time, check the appropriate icon.
11. Click \'Start.\' Wait for a short period while Office deletes all of the settings on all of the programs in the suite and restores it to its original installed state. This will apply the settings to Word, PowerPoint and Excel, and any other Office programs you have installed.
Read more ►

How to Flip Column Headings As Row Headings on an Excel Spreadsheet


1. Select and copy the entire data range you want to transpose. For example, if you have 10 columns and 10 headers, highlight them as well as all the data within. Excel will accurately transpose not only the column and header titles but also the data.
2. Click on a new location in your worksheet for the transposed information to go. The simplest thing to do is go down a few columns and click. This way you can compare the new information with the old before deciding which information to keep. You can delete the other data or decide to use the information in both formats.
3. Click on the “Edit” menu, then select “Paste Special” and click on the “Transpose” check box (located on bottom right of window). This will copy the information and transpose it at the same time, as opposed to the 'Edit' > 'Copy' function, which will merely copy the information but not transpose it.
4. Click the “OK” button and Excel automatically transposes the column and row labels, as well as all the data. This is important to understand because it will save you a lot of time when you realize you need to transpose headers and columns. It doesn't just transpose the header and column names, it also reorganizes all the data where it belongs.
5. Compare the new data with the old data and decide whether you want to keep both or just one set of data. It may be helpful to provide both sets of data as a draft to get an objective perspective on which works better. Then, once you've sought an outside opinion, you can delete one set of data. Either way, it's handy to have both available in case you decide the data was better in the original format before you transposed it.
Read more ►

How to Perform the Command to Center a Worksheet Both Horizontally Vertically


Excel 2003
1. Log on to your computer and open Excel 2003. Click the 'File' menu and choose 'Page Setup.'
2. Click the 'Margins' tab. Go to the 'Center on Page' section.
3. Check both the horizontal and vertical check boxes. Click 'OK' to print your centered worksheet.
Excel 2007
4. Open Microsoft Excel 2007 and open the spreadsheet you want to center. Click the Office button on the upper-left corner of the screen. Go to the 'Print' menu and select 'Print Preview.'
5. Choose the 'Page Setup' option and click the 'Margins' tab. Check the 'Horizontally' and 'Vertically' boxes in the 'Center on page' section. Click 'OK' to close the 'Page Setup' menu. Review the print preview of the document to make sure that it is properly centered.
6. Click 'Print' to send your centered spreadsheet to the printer. Click 'Close Print Preview' to return to the main screen.
Open Office Calc
7. Log on to your computer and open the Open Office Calc program. Click 'File' and then 'Open.'
8. Select the spreadsheet you want to center. Click the 'Format' menu and choose 'Page.'
9. Click the 'Page' tab. Check the 'Horizontal' and 'Vertical' checkboxes and click 'OK' to save the settings.
Read more ►

Monday, November 26, 2012

How to Compare Two Columns in VLookup


1. Open Excel 2010 and select a workbook. Click the 'File' tab and select 'Open.' Browse the files and locate the workbook. Click the workbook and select the 'Open' button. The workbook opens.
2. Sort the values that will be included in the vlookup. The first column needs to sort in ascending order. Click in the first cell of the third column. Click the 'Formulas' tab and select the 'Lookup Reference' button. Select 'Vlookup' from the list of functions. The function arguments window opens.
3. Click the 'Lookup value' field. Click the red arrow. Select the first cell in the third row. Click the 'Table Array' field. Click the 'Red Arrow.' Highlight the data in the two columns. Click the 'Column Index Number' field. Type '2.' Once the matched vlookup value is found, it will return the cell value in the 2nd column.
4. Type 'False' in the 'Range Lookup' field. False indicates an exact match while true will find a close enough match. Click 'OK.' Excel will compare the lookup value against the two columns in your spreadsheet and display the cell value in the second column if a match is found.
Read more ►

How to Align Text in Excel Cells


1. Start Microsoft Excel and open the file you want to change.
2. Select the cells in which you want to align the text.
3. Open the Format menu and select Cells.
4. In the Format Cells dialog box, select the Alignment tab.
5. In the Text Alignment pane, click the horizontal text box.
6. Select the horizontal alignment type such as left, right, center.
7. Click the vertical text box.
8. Select the vertical alignment type, such as top or bottom.
9. Select OK to accept the changes.
Read more ►

Sunday, November 25, 2012

How to Make a Selection in Microsoft Excel


1. Click a single cell with the mouse to select it. This cell will be surrounded by a black border and the row and column it belongs to will be highlighted in the frame around the spreadsheet. If you're only looking to select one cell, you're done!
2. Click the initial cell, keep the mouse button pressed down, and drag the mouse horizontally, vertically or diagonally to select multiple adjacent cells. Now the entire group of cells (called a range) will be shaded gray and surrounded by a black border.
3. Click the name of a column or row in the frame around your Excel spreadsheet to select an entire row or column. For example, click the letter 'B' to select the entire second column. Doing this will deselect any cells that are currently selected.
4. Click the mouse to select a single cell, hold down the 'Control' key of your keyboard, and click another cell to select two non-adjacent cells. As long as the 'Control' key is held down, any number of cells can be selected. Additionally, clicking an already selected cell with the 'Control' key held will deselect it without affecting other selections.
Read more ►

How to Make an Ogive in Excel


1. Open a new Excel spreadsheet. Type 'Data' into cell A1, then type 'Bins' into cell B1. Enter the data set that you want to use to create the Ogive chart into column A, starting with cell A2.
2. Enter the bins for your histogram into column B, starting with cell B2. The bins are the numbers that represent the top value in the data ranges for your histogram. For example, if you want to determine the frequency of ranges from '0 to 5,' '6 to 10' and '11 to 15,' your bins would be '5,' '10' and '15.' The bins will appear on your Ogive chart as values plotted on the horizontal axis.
3. Click 'File' and select 'Options' from the list the appears. Click 'Add-Ins' once the Options window appears, then click 'Go.' Place a check next to 'Analysis ToolPak,' then click 'OK.'
4. Select the 'Data' tab at the top of the screen, then click the 'Data Analysis' button on the right end of the Ribbon. Click 'Histogram' from the list in the window that appears, then click 'OK.'
5. Place your cursor in the 'Input Range' field in the Histogram window. Click cell A1 and hold down the mouse button. Drag the cursor down to the last cell in the first column that has data, then release the button. Place your cursor in the 'Bin Range' field, and select all filled cells in that column. Place a check in the box next to 'Labels.'
6. Place the cursor in the text field next to 'New Worksheet Ply' and enter a name for your worksheet. Place checks next to 'Cumulative Percentage' and 'Chart Output,' then click 'OK.' Your histogram and chart will appear on the screen.
7. Click the blue bars in the middle of the chart, then press 'Delete.' This will remove the frequency data and leave you with a line graph of your cumulative frequency.
Read more ►

Saturday, November 24, 2012

How to Import OFX Files Into Microsoft Excel


1. Click 'Start,' type 'notepad' (without quotes) and press 'Enter.' Press 'Ctrl O.' Click the 'File type' drop-down menu and select 'All Files and Folders *.*.' Locate your OFX file, select it and click 'Open.'
2. Browse through your OFX file. You will notice that there is a pattern among all entries. Each OFX file will be different, but in general you will notice fields of data such as times, amounts or comments. There will also be a selection of letters or characters separating each line of data (e.g., hrt]). This 'separator' will be the same throughout. Determine what the separator is.
3. Click 'View,' then 'Find and Replace.' In the 'Find' field, type out the separator that currently exists in your document.
4. Enter '|' (bar, not an L) by pressing 'Shift \' in the 'Replace' field. Click 'Replace All.' This will replace all the existing separators and replace them with bar--an Excel compatible separator.
5. Click 'File,' then 'Save As.' Click the 'File type' drop-down menu and select 'All Files and Folders.' Enter 'toimport.txt' (without quotes) in the file name and click 'Save.'
6. Launch Microsoft Excel. Click the Microsoft Office logo in the ribbon. Click 'Open.'
7. Select 'Text Files' from the list, then navigate to 'toimport.txt' and double-click it to open the file. The Text Import Wizard will open.
8. Select 'Delimited' in the 'Original data type' field. Click 'Next.'
9. Set the 'Delimiters' to '|' ('Shift \') and click 'Next.' A preview of your import will appear. Click 'Finish' to import your data to Microsoft Excel.
Read more ►

Blogger news