Thursday, August 16, 2012

How to Make Text Flash in Excel


1. Open the Microsoft Excel 2010 file in which you want to make the text flash. Press 'Alt' and 'F11' to open up the VBA console.
2. Right-click the 'ThisWorkbook' entry on the left side of the VBA console. Move your mouse over 'Insert' and choose 'Module.'
3. Double-click the 'ThisWorkbook' option. Copy the following code and paste it into the white space on the right side of the screen:Private Sub Workbook_Open()BlinkEnd SubPrivate Sub Workbook_BeforeClose(Cancel As Boolean)NoBlinkEnd SubThis code will start and the blinking text when you open this workbook, and stop the blinking text when you close the workbook, once you insert the code to tell Excel what Blink and NoBlink actually mean.
4. Double-click 'Module 1' from the list on the left side of the screen. Place your cursor on the right side of the screen and enter the following line:Public Timecount As DoubleThis creates a variable called 'Timecount' that you can use in every subroutine.
5. Press enter to move the cursor to the next line and enter the following code:Sub blink()With ThisWorkbook.Worksheets('Sheet1').Range('A1:A10').FontIf .ColorIndex = 3 Then.ColorIndex = 2Else.ColorIndex = 3End IfEnd WithTimecount = Now TimeSerial(0, 0, 1)Application.OnTime Timecount, 'Blink', , TrueEnd SubThis creates a subroutine called 'Blink' that will cause all the text within the defined range to flash. You can change the range from 'A1:A10' to whatever range you desire, including an individual cell.
6. Press 'Enter' to access the next line and enter the following code:Sub noblink()ThisWorkbook.Worksheets('Sheet1').Range('A1:A10').Font.ColorIndex = _xlColorIndexAutomaticApplication.OnTime Timecount, 'Blink', , FalseEnd SubThis will create a subroutine that will run when you close the workbook. It turns all the text back to black, so that someone who opens the workbook without macros enabled will not accidentally see nothing in the text boxes.
7. Close the VBA console by clicking the 'X' in the top-right corner. Click the 'File' tab at the top of the screen and choose 'Save as.' Select 'Excel Macro-enabled Workbook' from the drop-down field and type in a name for the workbook. Click 'Save.'
8. Close the Excel file and then reopen it. Your text, within the range defined in the macro, will start to flash. Depending on your security settings, you may need to click the 'Enable Macros' button at the top of the screen to see the flashing text.

Blogger news