Daniel is a Microsoft Excel MVP. He runs the Excel Hero blog and the Excel Hero Academy where students learn advanced Excel techniques. He can be followed @excelhero or you can interact with the Excel Hero LinkedIn Group, where some of the smartest Excel people on the planet hang out. The Oscars Ballot Predictor is an Excel 2013 template that showcases a new apps for Office technology. The Oscar Ballot Predictor (OBP) relies on a custom app for Excel that I built specifically for this template. Figure 1. The Oscars Ballot Predictor app utilizes JSON from the PredictWise prediction engine data feed. Apps for Office can be inserted into Office documents via the ribbon in a similar fashion as a shape or a chart, but at the heart of all apps is a web page, rendered by Internet Explorer. Dataprose.org (Winston Snyder)
Excel Macros. Dim Wb As Workbook SaveAll For Each Wb In Workbooks If Wb.Name <> ThisWorkbook.Name Then Wb.Close savechanges:=True End If Next Wb ThisWorkbook.Close savechanges:=True Closing All Inactive Workbooks This macro will close all of the workbooks, except the active workbook, which will remain open active.
Public Sub CloseAllInactive() Dim Wb As Workbook Dim AWb As String AWb = ActiveWorkbook.Name SaveAll For Each Wb In Workbooks If Wb.Name <> AWb Then Wb.Close savechanges:=True End If Next Wb Application.StatusBar = "All Workbooks Closed. " End Sub Date Functions In VBA A variety of Date and Time macros and functions are listed on the Date And Time Page. Other Date Related Procedures are described on the following pages. Adding Months And Years The DATEDIF Function Date Intervals Dates And Times Date And Time Entry Holidays Julian Dates Deleting Blank Rows For macros for deleting blank rows or duplicate rows in an range of cells, click here.
Flipping Or Mirroring A Range.
Chandoo on VBA. Excel VBA allows you to automate various activities you do in Excel.
We use Excel to analyze data, create reports, prepare charts & presentations, do calculations and understand information. When we are doing all these, we spend quite some time, repeating same steps. For example, we may prepare and email same type of report every week with different data. By using Excel VBA, we can cut down the time we spend repeating these steps and improve our productivity. In this section of our site, you will find information, tutorials, examples, tips & resources on Excel VBA & Macros. What is VBA? VBA stands for Visual Basic for Applications. The prospect of learning new languages scares us a lot. For example the following line says hello to you: MsgBox "hello" Just like any language, VBA too has its own rules, grammatical structures & nuances.
What is a Macro? Nate Oliver's blog. Good evening, I hope this finds everyone well!
Tonight we'll look at something a little eccentric - does Excel like Arrays? Most power-users know the answer is yes! But, let's use an example. Let's say you've created a Userform, and want to store the values of a dynamic amount of Textbox values in a Variable? How is one to approach this problem? Private Sub CommandButton1_Click()Dim ctrl As ControlDim strArr() As StringDim i As Long, j As Long ReDim strArr(1 To 500, 1 To 500) For Each ctrl In Me.Controls If TypeOf ctrl Is MSForms.TextBox Then Let i = i + 1 Let strArr(i, 1) = ctrl.Name Let strArr(i, 2) = ctrl.Text End IfNext 'For j = 1 To i' Debug.Print Me.Controls(strArr(j, 1)).Text, _' strArr(j, 1), strArr(j, 2)'Next MsgBox WorksheetFunction.VLookup( _ strArr(2, 1), strArr, 2, 0) Me.Hide: Unload MeEnd Sub I've commented-out my 'for j' loop, as that was a test, and I hardcoded the Lookup value (this is only left to the imagination).
What is this doing? Have a great night! -Nate Cheers, Methods In Excel. Excel VBA. If you are looking for Excel VBA code samples, here are some pages that should be useful to you.
Click on the links above to access the code. I also have a few more generic prcedures listed here.Please note that most of the examples on this site were written for Office 2003, but will work (for the most part) on Office 2007 and 2010. Don't forget to check out the Video Tutorials page! Fix Badly Imported Formulas If you have imported formulas from another program, you might have run into this problem where an apostrophe gets added to the beginning of each formula; so instead of viewing the results of the formula, you are viewing the formula itself.
This code should be lightning fast, even with large amounts of data, because it loops through an array instead of looping through the worksheet. Convert phone numbers I use the following code to put phone numbers into a standard format. Paste Values in Selected Cells Delete Empty Rows Selective Autofilter Remove Hyperlinks Rename Worksheet.
Programming PIVOTS with VBA.