Book Home Page Bloglines 1906 CelebrateStadium 2006 OfficeZealot Scobleizer TechRepublic AskWoody SpyJournal Computers Software Microsoft Windows Excel FrontPage PowerPoint Outlook Word ![]() ![]() Host your Web site with PureHost! ![]() |
![]() ![]() Wednesday, March 03, 2010 – Permalink – Mail ExcelVBA + sampleExcel Guru Ron de Bruin has put together the VBA code needed to send Excel via email.He has also included the sample workbooks for those that are not VBA literate. Also: ". . . a new add-in named RDBMail for Excel/Outlook 2007-2010 Code to send mail from Excel See all Topics excel <Doug Klippert@ 3:43 AM
Comments:
Post a Comment
Saturday, February 20, 2010 – Permalink – Selection AddressWhat's the count". . . know what range is selected at any given time. You can look at the Name Box, but that only show the active cell." Display number of Rows and Columns See all Topics excel Labels: Customize, Formulas, Macros, Reference, Shortcuts, Tips, VBA <Doug Klippert@ 3:59 AM
Comments:
Post a Comment
Friday, February 12, 2010 – Permalink – Custom ToolbarsYou’re not restrictedYou can create your own toolbars. Here's some code that helps: ![]() Toolbars for Fun and Profit See all Topics excel <Doug Klippert@ 3:09 AM
Comments:
Post a Comment
Monday, February 01, 2010 – Permalink – Tips for Word and ExcelAlso some Windows hintsThis site has useful information about:
See all Topics excel <Doug Klippert@ 3:32 AM
Comments:
Post a Comment
Wednesday, January 20, 2010 – Permalink – Help ID'sVBA codeWhen you build a macro, you can call up information from the Excel Help file.Ron DeBruin has the information needed through 2007. Right clicking the Helpfile and choosing Properties will show the HP####### number in 2010. Help Context IDs for Excel See all Topics excel <Doug Klippert@ 3:00 AM
Comments:
Post a Comment
Thursday, November 05, 2009 – Permalink – Change Code to CommentsFast solutionWhen you're testing procedures, you can temporarily convert a block of VBA code to comments that will be ignored during a trial run. Doing so manually by inserting an apostrophe before each line of code can be a real chore. To simplify this task,
See all Topics excel Labels: VBA <Doug Klippert@ 3:42 AM
Comments:
Post a Comment
Thursday, October 29, 2009 – Permalink – Hep MeHelp topic locationsThis from Ron de Bruin:
Help Context IDs for Excel See all Topics excel <Doug Klippert@ 3:09 AM
Comments:
Post a Comment
Saturday, September 12, 2009 – Permalink – Declaring Multiple VariablesDeclare each oneWhen setting up a macro in VBA, if you want to declare multiple variables in one line of code, be sure to specify the type for each variable, even if the variables are the same type. Avoid code like the following: Dim strFName, strLName, strMI As String In such a case, only the last variable, strMI, is actually declared as a String type. The first two variables are designated by default as Variant data types. To correctly declare the three variables, you would use the statement: Dim strFName As String, strLName As String, strMI As String See all Topics excel Labels: VBA <Doug Klippert@ 6:47 AM
Comments:
Post a Comment
Wednesday, September 02, 2009 – Permalink – Dynamic TabsChange tab names automaticallyChanging the names of tabs is easy, just double click the tab or right click and choose rename. Allen Wyatt has a small piece of code that will automatically update the tab name based on the value of a cell in the spreadsheet. Sub myTabName() ActiveSheet.Name = ActiveSheet.Range("A1") End Sub Allen also has some error checking code on his site: Dynamic Worksheet Tabs Dick Kusleika suggests another way using a change event: Naming a sheet based on a cell See all Topics excel <Doug Klippert@ 3:33 AM
Comments:
Post a Comment
Wednesday, August 05, 2009 – Permalink – Large Text FilesSplit between worksheetsWhile this problem is alleviated in Excel 2007 with its 1,048,576 rows by 16,348 columns, The old XL versions are still here. Text files with a large number of records are better handled in a program like Access. Having said that, there can be times that these lists must be imported into Excel. If the file has over 65,536 records, the data will not fit on a single worksheet. Here's a Microsoft Knowledge Base article with the macro code needed to bring oversized text data into Excel and split it into multiple worksheets: Sub LargeFileImport() 'Dimension Variables Dim ResultStr As String Dim FileName As String Dim FileNum As Integer Dim Counter As Double 'Ask User for File's Name FileName = InputBox("Please enter the Text File's name, e.g. test.txt") 'Check for no entry If FileName = "" Then End 'Get Next Available File Handle Number FileNum = FreeFile() 'Open Text File For Input Open FileName For Input As #FileNum 'Turn Screen Updating Off Application.ScreenUpdating = False 'Create A New WorkBook With One Worksheet In It Workbooks.Add template:=xlWorksheet 'Set The Counter to 1 Counter = 1 'Loop Until the End Of File Is Reached Do While Seek(FileNum) <= LOF(FileNum) 'Display Importing Row Number On Status Bar Application.StatusBar = "Importing Row " & _ Counter & " of text file " & FileName 'Store One Line Of Text From File To Variable Line Input #FileNum, ResultStr 'Store Variable Data Into Active Cell If Left(ResultStr, 1) = "=" Then ActiveCell.Value = "'" & ResultStr Else ActiveCell.Value = ResultStr End If 'For Excel versions before Excel 97, change 65536 to 16384 If ActiveCell.Row = 65536 Then 'If On The Last Row Then Add A New Sheet ActiveWorkbook.Sheets.Add Else 'If Not The Last Row Then Go One Cell Down ActiveCell.Offset(1, 0).Select End If 'Increment the Counter By 1 Counter = Counter + 1 'Start Again At Top Of 'Do While' Statement Loop 'Close The Open Text File Close 'Remove Message From Status Bar Application.StatusBar = False End Sub Importing Text Files Larger Than 16,384/65,536 Rows Notice the code about 17 lines from the bottom of the macro. 'For xl97 and later change 16384 to 65536. Also, after import, the data must be parsed. Use Data>Text to columns. If you have not worked with macros before, Dave McRitchie has a tutorial: Getting Started with Macros and User Defined Functions See all Topics excel <Doug Klippert@ 3:13 AM
Comments:
Post a Comment
Thursday, July 23, 2009 – Permalink – Excel VBA Help FileDownload from MicrosoftHere is a downloadable compiled Help file covering the vagaries of Excel VBA. You can use this file without having to, necessarily opening the application. Excel 2003 VBA Language Reference See all Topics excel Labels: VBA <Doug Klippert@ 3:58 AM
Comments:
Post a Comment
Tuesday, June 30, 2009 – Permalink – Thirtieth Condition FormattingThree is not always enoughPre-2007 Excel gives the user the ability to specify up to three conditions under Format>Conditional Formatting. If that is not enough, Frank Kabel and Bob Phillips of xlDynamic.com offer a free download that extends the conditions to 30! ![]() Extended Conditional Formatter Also see: Conditional Formatting (including 2007) See all Topics excel <Doug Klippert@ 3:09 AM
Comments:
Post a Comment
Wednesday, June 17, 2009 – Permalink – VBA Variable ProblemsExplicit protectionIt's good practice to always use the Option Explicit statement in the beginning of your code modules to ensure that all variables are unambiguously declared in your procedures. With this process in place, you'll receive a "Variable not defined" error if you try to execute code containing undeclared variables. Without this statement, it's possible to mistype variable names, which would be interpreted as new Variant type variables. This could severely impact the results of your code, and you might not ever know it. If you do find a problem, tracking down where the error is can be a chore. Although you can manually type the statement into your modules, changing a setting in Access can ensure that the statement is always added to new modules.
See all Topics excel Labels: VBA <Doug Klippert@ 3:36 AM
Comments:
Post a Comment
Monday, June 01, 2009 – Permalink – Count the ColorsI bid 3 RedWhat if you would like to know the color name or to count or to sum cells by a fill color? There is no built-in function in Excel.Sum and Count by fill color Chip Pearson: Working with Cell Colors See all Topics excel <Doug Klippert@ 3:17 AM
Comments:
Post a Comment
Thursday, April 09, 2009 – Permalink – Excel-lent E-MailOutlook, Excel, and VBARon de Bruin, Microsoft MVP - Excel, has put together a collection of VBA routines to make Excel e-mail friendly. See if these topics tempt you: Example Code for sending mail from Excel
Also see: <Doug Klippert@ 3:27 AM
Comments:
Post a Comment
Friday, April 03, 2009 – Permalink – Where Have All the Bytes Gone?Folder size listYou can create a list in Excel of all the folders on a drive and their sizes. (The credit goes to Peter Beach, an Excel MVP.) Get Folder Size code
<Doug Klippert@ 3:56 AM
Comments:
Post a Comment
Wednesday, March 04, 2009 – Permalink – Animate Window SizeSo cool!The following macro has little or no practical computing value, but it can add a "way cool" element when a worksheet is unhidden. There are three states that a worksheet can be in; Minimized, Maximized, and Normal. From AutomateExcel.com: ActiveWindow.WindowState (By Mark William Wielgus) Also fun: Sub SheetGrow() Dim x As Integer, xmax As Integer With ActiveWindow .WindowState = xlNormal .Top = 1 .Left = 1 .Height = 50 .Width = 50 If Application.UsableHeight > Application.UsableWidth Then xmax = Application.UsableHeight Else xmax = Application.UsableWidth End If For x = 50 To xmax If x <= Application.UsableHeight Then .Height = x If x <= Application.UsableWidth Then .Width = x Next x .WindowState = xlMaximized End With End Sub # posted by Joerd : 12/30/2005 See all Topics excel <Doug Klippert@ 3:27 AM
Comments:
Post a Comment
Sunday, November 30, 2008 – Permalink – Time Without LimitsNo DelimitersExcel is most happy when you enter dates and times with the correct separators. 1/1/2004 is a good date. So is 1-1-2004. If you just entered 112004 in a cell formatted as a date you'll get: Wednesday, August 27, 2206 the 112,004th day since January 1, 1900. Chip Pearson has come up with VBA code, using the Worksheet_Change event procedure, that will allow you to enter dates without dashes or slashes.
<Doug Klippert@ 3:45 AM
Comments:
Post a Comment
Friday, November 14, 2008 – Permalink – Sort WorksheetsOrder tabsWorksheets can be dragged and dropped into any order required. They can be set up in numeric or alpha order, but doing it by hand is a bother. Chip Pearson has written some macros that will do the job for you:
<Doug Klippert@ 3:37 AM
Comments:
Post a Comment
Thursday, September 04, 2008 – Permalink – Running Total in CommentCircular solutionYou can't have a worksheet formula that looks like this: =C3+C3 But you can do something similar if you use VBA and store the results in another location. "In Microsoft Excel you can avoid circular references when you create a running total by storing the result in a non-calculating part of a worksheet. This article contains a sample Microsoft Visual Basic for Applications procedure that does this by storing a running total in a cell comment."
<Doug Klippert@ 12:06 PM
Comments:
Post a Comment
Wednesday, August 13, 2008 – Permalink – Value of Cell in Headeror FooterThe header and footer cannot contain a link to a cell. You can create and run a macro that will put the value of a cell into a footer or header. You could run this macro each time the contents of the specified cell changes.
Or use it as an Event code:
OzGrid.com: Information from a cell in a worksheet
Excel Basics: Setup Header/Footer
<Doug Klippert@ 4:27 AM
Comments:
Post a Comment
Saturday, July 19, 2008 – Permalink – Run a Macro from CellHow to do the impossible (almost)There are times when it might be nice to run a macro from a cell function. Something like : if a cell has a certain value, a macro will run: =IF(A1>10,Macro1) You can not initiate a macro from a worksheet cell function. However, you can use the worksheet's Change event to do something like this:
Also see: After posting this, Ross Mclean of Methodsinexcel.co.uk came up with a great work around using a User Defined Function.
You can see the simple coding here: Running a macro from a cell. Public Function RMAC _ when invoked by this worksheet formula: =rmac("MyMacro","yada") runs the sub MyMacro with some modification. The Beep is executed, the cell color change is not. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ See all Topics excel <Doug Klippert@ 2:09 AM
Comments:
Post a Comment
Friday, July 18, 2008 – Permalink – Signing MacrosSecurity levelsThere are three levels of Macro security:
"If you've used Access 2003, you've probably seen several security warning messages - Access 2003 cares about your security. An important part of Access 2003 security is digitally signing your code. As Rick Dobson shows, you can do it, but preparing for digital signing is critical. Also: Other links: <Doug Klippert@ 5:00 AM
Comments:
Post a Comment
Monday, July 14, 2008 – Permalink – Column(s) FunctionVLOOKUP"Excel will adjust cell references in formulas when you insert or delete rows or columns.
Also: <Doug Klippert@ 5:25 AM
Comments:
Post a Comment
Thursday, July 03, 2008 – Permalink – Show Formulas in Cell CommentsDisplay propertiesSelect the cells and then run this macro:
<Doug Klippert@ 5:11 AM
Comments:
Post a Comment
Sunday, June 29, 2008 – Permalink – Customize Date in FooterFormattingThis subroutine inserts the current date in the footer of all sheets in the active workbook. This process can be accomplished without a macro, however, you'll need the macro if you want to specify the formatting of the current date. An example of the return generated by running this macro is Saturday, March 05, 2005.
Microsoft KnowledgeBase: <Doug Klippert@ 3:11 AM
Comments:
Post a Comment
Saturday, May 17, 2008 – Permalink – Enter in Multiple WorkSheetsGroup sheetsA common use for Excel is to keep periodic statistics; sales by quarter, or phone calls per month. It can be tedious to try to create worksheets for each month and include duplicate data such as client or salesperson's names. Set up the workbook with as many worksheets that may be needed; perhaps one for each month and one for cumulative year-end totals. Click the tab for the first month, hold down the SHIFT key and select the last worksheet in the series. All the sheets are now chosen. You will see [Group] on the Title bar. Enter any common information on the first sheet and it will be duplicated on all of the grouped sheets. When you are done, Right-click a sheet tab and choose Ungroup Sheets on the context menu. Non-contiguous sheets can be selected using the Ctrl key. If the sheets are grouped, they will all be printed together. Also:
<Doug Klippert@ 7:51 AM
Comments:
Post a Comment
Thursday, February 21, 2008 – Permalink – VBA, Named ArgumentsAn easier read
MsgBox(prompt[, buttons] [, title] [, helpfile, context]) When you work the MsgBox function this way, the order of the arguments can't be changed. Therefore, if you want to skip an optional argument that's between two arguments you're defining, you need to include a blank argument, such as: MsgBox "Hello World!", , "My Message Box" Named arguments allow you to create more descriptive code and define arguments in any order you wish. To use named arguments, simply type the argument name, followed by :=, and then the argument value. For instance, the previous statement can be rewritten as: MsgBox Title:="My Message Box", _ (To find out a function's named arguments, select the function in your code and press [F1].) See all Topics excel Labels: VBA <Doug Klippert@ 7:56 AM
Comments:
Post a Comment
Monday, December 17, 2007 – Permalink – Reset Shortcut MenuContext menu redo
Sub ResetShortcutMenu() Macros that Customize and Control Shortcut Menus See all Topics excel <Doug Klippert@ 5:15 AM
Comments:
Post a Comment
Sunday, December 16, 2007 – Permalink – Office VBA StuffVideo + Free codeQuick tips VBA Video "Learn tips and use sample code for several Office applications. These tips can help you to be more productive and can also be a starting point for developing your own tools, utilities and techniques."
Ten Tips for Office VBA Developers See all Topics excel Labels: VBA <Doug Klippert@ 5:07 AM
Comments:
Post a Comment
Saturday, November 03, 2007 – Permalink – Automation - VBA - Help FileOffice Wide
See all Topics excel Labels: VBA <Doug Klippert@ 6:50 AM
Comments:
Post a Comment
Tuesday, June 19, 2007 – Permalink – Indent CodeRealign a bunchIndenting blocks of VBA code, such as statements within loops or If...Then statements, makes reading a procedure much easier. You probably indent a code statement using the [Tab] key, and outdent by using [Shift][Tab]. However, you may not be aware that the [Tab] and [Shift][Tab] techniques also work when multiple code lines are selected. The Visual Basic Editor also provides Indent and Outdent buttons on the Edit toolbar that allow you to easily reposition blocks of code. See all Topics excel Labels: VBA <Doug Klippert@ 6:29 AM
Comments:
Post a Comment
Sunday, April 22, 2007 – Permalink – Numbers to WordsCardinal numbers
<Doug Klippert@ 6:36 AM
Comments:
Post a Comment
Friday, April 13, 2007 – Permalink – Select by CodeProgrammatically pick cells
Labels: VBA <Doug Klippert@ 6:46 AM
Comments:
Post a Comment
Saturday, March 31, 2007 – Permalink – Comment CodeEdit toolbar
<Doug Klippert@ 7:06 AM
Comments:
Post a Comment
|