<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <generator>RSS Builder by B!Soft</generator>
    <title>Programming with Excel VBA macros - tips, tricks and examples</title>
    <link>https://sitestory.dk/excel_vba/</link>
    <description>Tips, tricks and examples on how to make VBA macros in Excel.</description>
    <language>en-gb</language>
    <managingEditor>kan-hurtigt-skifte@sitestory.dk</managingEditor>
    <webMaster>kan-hurtigt-skifte@sitestory.dk</webMaster>
    <item>
      <title>Appending text to existing text file</title>
      <pubDate>Sun, 18 Feb 2018 15:34:57 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/log-access.htm</link>
      <guid isPermaLink="false">5c5a407b-4fc2-4446-b9d6-c8eb763970b2</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA</category>
      <description><![CDATA[<p>
	How to append text to an existing text file with a VBA macro. The example shows how to log date, time and username, when a workbook is opened, and if the username is different from whatever.</p>
]]></description>
    </item>
    <item>
      <title>Calendars in Excel with VBA macros</title>
      <pubDate>Mon, 21 Aug 2017 15:03:14 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/excel-calendar.htm</link>
      <guid isPermaLink="false">5ddd6cc6-8015-482f-a359-66ed7e9dd1ab</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	I have updated the page about making calendars in Excel. There is a bunch of new macros that can make calendars with different layouts. The Easter dates are calculated, there are 10 holidays with fixed dates (e.g. Christmas), and the user can define up to 30 holidays/anniversaries of his own (Mom&#39;s birthday, the day Elvis didn&#39;t die - whatever). A calendar is placed in a new workbook.</p>
<p>
	The code also read the system settings to get the right date format, first week of the day and more.</p>
<p>
	The macros exemplify how class collections can make things a lot easier and less complicated. You can download a workbook with it all.</p>
]]></description>
    </item>
    <item>
      <title>Conditional formatting using VBA macros</title>
      <pubDate>Sun, 11 Jun 2017 09:05:00 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/conditional-format-vba.htm</link>
      <guid isPermaLink="false">578e38d2-344d-4b90-b5b7-9f4c465b3a83</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	Conditional formatting is a smart way to highlight cells with values above or below a certain limit - or some other criteria. For instance cells can get a red background colour.</p>
<p>
	However it is very difficult (if possible) to count the cells that are changed, so in some cases it is better to use VBA macros instead. This page shows an example, and you can download a workbook with the example.</p>
]]></description>
    </item>
    <item>
      <title>Make a calendar in Excel with VBA macros</title>
      <pubDate>Sun, 30 Oct 2016 11:03:49 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/excel-calendar.htm</link>
      <guid isPermaLink="false">b8186aa6-99ef-4e7a-bb89-6b050fab6c16</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	VBA macro that makes a calendar in Excel. The calendar is a new workbook with a sheet for every month. It should work for all years after 1900. It recognizes leap years and fills weekend collumns with a different colour.</p>
<p>
	The number of rows is user defined, unless you want a calendar with 24 rows for 24 hours and the hour intervals (00-01, 01-02 etc.)..</p>
<p>
	A calendar in Excel is fine for keeping track of e.g. how many hours uou spend on different tasks/projects, overtime, employees or whatever.</p>
<p>
	The macro will prompt you for the year and number of rows and then make the calendar in a split second. You can download a workbook with the code.</p>
]]></description>
    </item>
    <item>
      <title>Dependent ComboBoxes, and arrays in class collection</title>
      <pubDate>Sun, 24 Jan 2016 10:51:31 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/arrays-class-collection.htm</link>
      <guid isPermaLink="false">785ccb28-46bb-43dc-b649-5023e2fb8e9a</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	Shows how the selection in one ComboBox can control the list in another. The example uses a dynamic number of arrays stored in a class collection, which is great if you don&#39;t know how many arrays to declare..</p>
<p>
	It is not as complicated as it may sound! Sample workbook for download.</p>
]]></description>
    </item>
    <item>
      <title>Copy formulas from one workbook to another without links</title>
      <pubDate>Fri, 16 Oct 2015 11:21:55 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/copy-formulas.htm</link>
      <guid isPermaLink="false">6034580e-b581-4a1f-a48e-5fd65ebac6bf</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	If you copy cells with formulas from one workbook to another, the formulas will contain a reference to the workbook you copied from.</p>
<p>
	If you don&#39;t want that, you can do a search and replace, where you replace the reference with nothing, but if it is something you do frequently, it is smarter to use a macro.</p>
<p>
	The trick is to copy all the formulas (not the values) in a range to an array in one go, and then copy the array to a range in the other workbook. That way the formulas will not change in any way.</p>
<p>
	The macro also shows how to let the user select ranges, how to use the GetOpenFileName method to get a file name and path and a simple way to check if a workbook is open or not.</p>
]]></description>
    </item>
    <item>
      <title>Copy rows using criteria</title>
      <pubDate>Sat, 10 Oct 2015 13:06:50 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/copy-rows-criteria.htm</link>
      <guid isPermaLink="false">ac14d843-98ad-4885-8e65-d2916e7e269c</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	A frequently asked question is how to find rows in a table by using criteria and copy them to another table in another workbook. It could be rows that contain a specific customer ID, a name or whatever.</p>
<p>
	This page shows an example on how to do just that. It uses the Like operator to look for matches. &quot;Like&quot; can look for exact matches, and it allows patterns with wildcards. The copied rows are inserted as a new table in another (new) workbook, but that can easily be modified.</p>
<p>
	The macro uses an inputbox, ranges, arrays and a loop.</p>
<p>
	&nbsp;</p>
]]></description>
    </item>
    <item>
      <title>Calendar and date picker on userform</title>
      <pubDate>Sat, 22 Aug 2015 09:51:04 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/calendar.htm</link>
      <guid isPermaLink="false">41e4913c-a469-4d34-b84a-c63bf7044e5a</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	I made this calendar and date picker for the fun of it. Pick up to two dates and copy them to cells or ranges of cells in the sheet.</p>
<p>
	Names of months and days, first day of the week and possible date formats are based on the user&#39;s system settings. Several examples on how to use date functions, and there is also a simple class module to handle click events by declaring Public WithEvents.</p>
<p>
	If you want to use the date(s) for something special, you can just add your own code.</p>
<p>
	I wrote this for the fun of it using VBA macros only and no ActiveX. Different versions of MS Office use different ActiveX controls, and that causes problems, which you avoid if you use VBA only.</p>
]]></description>
    </item>
    <item>
      <title>SUMIF function ignoring hidden cells</title>
      <pubDate>Sun, 09 Aug 2015 07:33:32 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/sumif-ignore-hidden.htm</link>
      <guid isPermaLink="false">fd38e902-0dc4-45be-8060-c816e4437029</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	A reader asked me how to make Excel&#39;s SUMIF function ignore hidden cells. There is a complicated workaround using SUMPRODUCT, SUBTOTAL and OFFSET, but a VBA worksheet function is much easier to use, and here it is.</p>
]]></description>
    </item>
    <item>
      <title>Make your own worksheet functions and addin</title>
      <pubDate>Sun, 09 Aug 2015 07:24:29 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/your-own-worksheet-functions.htm</link>
      <guid isPermaLink="false">2c1b639e-6bfb-416d-90af-eeacec70090f</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	Excel has many worksheet functions like SUM(), AVERAGE() etc., but if you have special needs, you can write your own worksheet functions using VBA.</p>
<p>
	This page shows how, and it also shows you can save the functions as an addin, so you can use them in all your workbooks.</p>
]]></description>
    </item>
    <item>
      <title>Using worksheets functions on VBA arrays</title>
      <pubDate>Wed, 22 Jul 2015 14:28:31 GMT</pubDate>
      <guid isPermaLink="false">317bf54b-a651-4501-a152-7c5610abc972</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	It is very fast to copy data, that meets certain criteria, from one array to another, and it is very handy that you can use worksheet functions on the array without copying to the worksheet. The page shows some simple examples, and there is a zip-compressed (more advanced) example with two workbooks: One containing the macros amd one containing data.</p>
<p>
	With this technique you can analyze a lot of data in seconds.</p>
]]></description>
    </item>
    <item>
      <title>Delete rows by using criteria</title>
      <pubDate>Sat, 06 Jun 2015 08:34:05 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/delete-rows-criteria.htm</link>
      <guid isPermaLink="false">fdec036f-4565-4ac2-8992-ef565380bb0e</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	Excel VBA macro that deletes rows in a table if values in a selected column meets a user defined criteria - e.g. if the value is lower than 300.</p>
<p>
	The macros use ranges, arrays, userforms, a listbox, loops and more. The macros are in one spreadsheet that operates on another containing the data. That is useful if the data has been imported from a text file or a csv-file.</p>
<p>
	You can download a zip-compressed spreadsheet with the macros and userforms.</p>
]]></description>
    </item>
    <item>
      <title>Calculate stop time, runtime etc. with VBA</title>
      <pubDate>Sat, 06 Jun 2015 08:34:31 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/stop-start-times.htm</link>
      <guid isPermaLink="false">87357f9a-c555-494b-9c3a-d036ddf9e601</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	A sample Excel VBA macro to calculate stops, starts, stop time, runtime, meantime between stops and more.</p>
<p>
	If you can get something resembling a log file with times into Excel, you can tailor a macro to calculate time and extract data. Calculating time can be useful for much more than just stops and starts.</p>
<p>
	The example uses the VBA function DateDiff, loops, ranges, arrays and a collection. You can also download a spreadsheet with the example.</p>
]]></description>
    </item>
    <item>
      <title>Animated charts in Excel</title>
      <pubDate>Sun, 30 Nov 2014 11:45:20 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/animated-charts.htm</link>
      <guid isPermaLink="false">389ffc67-e678-45db-8f8e-56870926ddfa</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	With a fairly simple VBA macro you can animate charts in Excel. The trick is to pause code execution by using the Windows API function &quot;Sleep&quot; and to give the chart time to update by using VBA&#39;s DoEvents function.</p>
<p>
	You can watch a video with examples and download the spreadsheet used in the video.</p>
]]></description>
    </item>
    <item>
      <title>Round to nearest 100, 1000 etc. with VBA macro</title>
      <pubDate>Sun, 16 Nov 2014 14:42:00 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/round-up.htm</link>
      <guid isPermaLink="false">b7e94a35-33a1-48d9-92f7-e3a22822bfba</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	The other day I needed a macro to scale a chart&#39;s Y axis in a macro-animated chart. I could not use the chart&#39;s autoscale, because it would look silly if the Y axis changed continuously.</p>
<p>
	It is easy to scale to e.g. the nearest thousand, but a chart would look pretty silly if the highest value is 7. You need something more flexible.</p>
<p>
	So I wrote this function that will return a round value depending on the input value. Examples:</p>
<p>
	2 returns 3</p>
<p>
	13 returns 20</p>
<p>
	67 returns 70</p>
<p>
	136 returns 200</p>
<p>
	377 returns 400</p>
<p>
	1477 returns 2000</p>
<p>
	3333 returns 4000</p>
<p>
	etc.</p>
<p>
	It is easy to modify the function, if you need to round up <strong>or</strong> down.</p>
]]></description>
    </item>
    <item>
      <title>Pareto charts or diagrams using VBA macros</title>
      <pubDate>Sat, 04 Oct 2014 07:52:08 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/pareto-chart.htm</link>
      <guid isPermaLink="false">6768b17b-bc96-444e-9d56-56c0e95e0a56</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	A Pareto chart is a sorted bar chart with a curve displaying accumulated percent. It is used to visualize the most important factors and is a Lean Six Sigma darling.</p>
<p>
	It isn&#39;t difficult to make manually, and there are many tutorials on the internet, but it takes time, and why bother when you can make them fast and easy using VBA macros? This page shows how to, and there is also a sample Excel workbook. The chart&#39;s source values don&#39;t have to be in the same workbook as the macros.</p>
]]></description>
    </item>
    <item>
      <title>Histograms in Excel with VBA macros</title>
      <pubDate>Mon, 25 Aug 2014 16:29:12 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/histogram-vba.htm</link>
      <guid isPermaLink="false">daf72a65-7617-401c-b72d-777c61ea9b09</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	The page about histograms has been updated, and there are now two examples.</p>
<p>
	The first one shows how to make a histogram (columns) with a bell shaped curve. The curve has a normal distribution and is based upon the data set&#39;s standard deviation and mean value.</p>
<p>
	The curve is made by generating 2000 &quot;random&quot; numbers with VBA&#39;s random number generator, Rnd, in combination with a worksheet function.</p>
<p>
	The other example shows how to make a histogram with a userdefined number of columns/intervals.</p>
<p>
	You can also download a workbook with the VBA code and start making histograms straight away.</p>
]]></description>
    </item>
    <item>
      <title>Using Excel's Solver with VBA macros</title>
      <pubDate>Wed, 19 Mar 2014 16:35:32 GMT</pubDate>
      <guid isPermaLink="false">dfa01e86-a1cb-42dc-b7c4-8cbd29792798</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	A page on how to use Solver with VBA macros. You can also download a spreadsheet with a sample application. The objective is to mix raw materials to the right chemical composition at the lowest cost.</p>
]]></description>
    </item>
    <item>
      <title>For Each Next loops in your own VBA class collections</title>
      <pubDate>Sat, 01 Mar 2014 11:52:51 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/for-each-next-in-class-collections.htm</link>
      <guid isPermaLink="false">99ba719c-0f07-4795-b152-e1276fbfdf95</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	Class collections are great for structured programming, and you don&#39;t need to remember a zillion variables.</p>
<p>
	However you cannot use the fast For Each Next loop to loop through your own class collections. That is: Unless you know the trick. This page shows how to do it.</p>
]]></description>
    </item>
    <item>
      <title>Sitemap with page descriptions</title>
      <pubDate>Sat, 15 Feb 2014 17:26:56 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/page-index.htm</link>
      <guid isPermaLink="false">a210d325-4ab0-484e-ad3d-84ef23986232</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	The number of Excel VBA pages on this site is growing, so it was high time to add a sitemap with short page descriptions. I have tried to group by topics, although it isn&#39;t always easy.</p>
]]></description>
    </item>
    <item>
      <title>Split a text file into smaller files with Excel VBA</title>
      <pubDate>Sat, 01 Feb 2014 10:23:50 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/split-textfiles.htm</link>
      <guid isPermaLink="false">98b87b6a-284d-4fc2-b5cd-5b230cd04377</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	This page shows how you can split a text or csv file into smaller files with a user defined number of lines (rows).</p>
<p>
	I wrote the macro, when I wanted to import access log files for my website into Excel for analysis. These files can be pretty big, and Excel 2003 (which I still use) has a max number of rows of &quot;only&quot; 65536.</p>
<p>
	The macro splits the text file into smaller files with e.g. 65500 lines/rows. The last file will usually be smaller. The new files are saved in the same folder as the original and get the same name with a number added (1, 2, 3 etc.).</p>
<p>
	The macro uses the HetOpenFileName function, the Split() function, arrays, a Do While loop and shows how to open and save files with VBA.</p>
]]></description>
    </item>
    <item>
      <title>Page about Listboxes on Userforms updated</title>
      <pubDate>Sat, 30 Nov 2013 11:29:44 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/listboxes.htm</link>
      <guid isPermaLink="false">a9bea00d-2006-45f2-9ac8-1975f349ef31</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	The page about ListBoxes on Userforms has been updated with examples on how to use an array as the list source. You simply set the list = the array, be it 1 or more columns.</p>
]]></description>
    </item>
    <item>
      <title>Import csv files using VBA macros</title>
      <pubDate>Sun, 24 Nov 2013 14:55:43 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/csv-file-import.htm</link>
      <guid isPermaLink="false">f35e6501-7762-421a-95a1-b89d60d3be55</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[<p>
	It has become quite common to download data in csv files. It is easy to import the files to Excel and also using VBA macros to do the job. However if semicolon was used to separate the values, it can be tricky, unless you know how to twist VBA.</p>
]]></description>
    </item>
    <item>
      <title>Double-click as an alternative to hyperlinks</title>
      <pubDate>Sat, 09 Nov 2013 13:48:36 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/hyperlinks-alternative.htm</link>
      <guid isPermaLink="false">784d4be8-65ab-4401-9188-74564d1ee489</guid>
      <author>kan-hurtigt-skifte@sitestory.dk</author>
      <category>Excel VBA Macros</category>
      <description><![CDATA[With a bit of macro programming double-click can be used as an alternative to hyperlinks in Excel, when you want to jump between cells, sheets or workbooks.
Hyperlinks are smart, but it can take a long time to make them, and you risk messing things up, if you insert a row or column in the destination sheet and the link isn't to a named range.]]></description>
    </item>
    <item>
      <title>Get updates about Excel VBA macros automatically</title>
      <pubDate>Mon, 04 Nov 2013 16:07:08 GMT</pubDate>
      <link>https://sitestory.dk/excel_vba/vba-start-page.htm</link>
      <guid isPermaLink="false">d5f2f76b-1b35-4b9f-84e6-70c4b0ba902d</guid>
      <description><![CDATA[I have now made this RSS feed, so you can get notice when the Excel VBA pages are updated.]]></description>
    </item>
  </channel>
</rss>