<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2509167754737584590</id><updated>2012-01-31T01:07:32.927+05:30</updated><category term='countif two criteria'/><category term='Hide cell contents before printing'/><category term='Sum Top 5 values in Unsorted Range'/><category term='Forcing users to use updated version'/><category term='Macros in Excel'/><category term='countif array'/><category term='PMT Function in Excel'/><category term='Test if workbook is open or not'/><category term='Formating Numbers in Excel'/><category term='Symbol Check Mark'/><category term='Disable Cut Copy Paste in Excel'/><category term='Pivot Tables'/><category term='Range Name Excel'/><category term='calculating age'/><category term='Custom Functions'/><category term='Excel Vlookup Function'/><category term='subtotal function excel'/><category term='multiple countif'/><category term='Deploy Macros Found Elsewhere'/><category term='Get Number From String'/><category term='countif with multiple criteria'/><category term='Send email with VBA'/><category term='Excel Currency Format'/><category term='Excel Macros'/><category term='Excel Formulas'/><category term='sumif multiple'/><category term='subtotal in excel'/><category term='Auto Open Macro'/><category term='Extract Number From String'/><category term='Automating Tasks in Excel'/><category term='Adding non printing information to your worksheet'/><category term='Find Duplicate'/><category term='Hardware Locking for Excel Workbook'/><category term='Excel Date Picker'/><category term='Profit and Loss report using Pivot Tables'/><category term='Excel Last Row'/><category term='Find Last Row'/><category term='Extract Number From Text'/><category term='EMI Calculator'/><category term='Macro Last Row'/><category term='File Open'/><category term='countif multiple conditions'/><category term='Excel Pop up Calendar'/><category term='Wingdings Check Mark with double click'/><category term='Sorting Dates by Birthday'/><category term='Disable right click menu'/><category term='Working with date function'/><category term='excel subtotals'/><category term='Excel Kay Board Shortcuts'/><category term='Defined Names'/><category term='Excel Closest Match'/><category term='Indian Style Comma Separation for numbers'/><category term='Converting Text to date'/><category term='Convert Numbers to Words'/><category term='Working with Data Range'/><category term='Show Developer Tab'/><category term='Logging User Activity'/><category term='Numbers to Text'/><category term='VBA Last Row'/><category term='Countif Multiple Criteria'/><category term='Email Address Extract'/><category term='Add Spin Buttons ActiveX Controls'/><category term='Visual Basic Grammar'/><category term='Formating Cells in Excel'/><category term='Making EMI Calculator'/><category term='Excel Number Format'/><category term='sumif multiple criteria'/><category term='subtotals in excel'/><category term='multiple sumif criteria'/><category term='Remove Duplicate'/><category term='Learn Excel VBA'/><category term='Forcing users to Enable Macros'/><category term='subtotal excel'/><category term='Text To Numbers'/><title type='text'>Yogesh Gupta's Excel Tips</title><subtitle type='html'>Daily use tips for excel. Solution to frequently faced excel problems in simple manner.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>60</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7235845626200938262</id><published>2010-07-24T23:24:00.001+05:30</published><updated>2010-07-24T23:25:33.398+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Send email with VBA'/><title type='text'>Excel Macros : Send Email with VBA</title><content type='html'>The Code I am sharing with you today is capable of sending active sheet of your workbook through outlook mail to email ID specified by you. You will not get any warning messages and the email will be sent using outlook profile available on your machine.&lt;br /&gt;&lt;br /&gt;This code saves active sheet to temp file and then email it to the recipient. Once the mail has been sent the temp file is deleted by the code.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Sub EmailActiveSheetWithOutlook()&lt;br /&gt;    &lt;br /&gt;    Dim oApp, oMail As Object, _&lt;br /&gt;    tWB, cWB As Workbook, _&lt;br /&gt;    FileName, FilePath As String&lt;br /&gt;&lt;br /&gt;    Application.ScreenUpdating = False&lt;br /&gt;&lt;br /&gt;'Set email id here, it may be a range in case you have email id on your worksheet&lt;br /&gt;    &lt;br /&gt;    Mailid = "yogesh@yogeshguptaonline.com"&lt;br /&gt;    &lt;br /&gt;'Write your email message body here , add more lines using &amp; vbLf _ at the end of each line&lt;br /&gt;    &lt;br /&gt;    Body = "Please find enclosed " &amp; vbLf _&lt;br /&gt;    &amp; vbLf _&lt;br /&gt;    &amp; "Thanks &amp; Regards"&lt;br /&gt;    &lt;br /&gt;   &lt;br /&gt;'Copy Active Sheet and save it to a temporary file&lt;br /&gt;&lt;br /&gt;    Set cWB = ActiveWorkbook&lt;br /&gt;    ActiveSheet.Copy&lt;br /&gt;    &lt;br /&gt;    Set tWB = ActiveWorkbook&lt;br /&gt;    FileName = "Temp.xls" 'You can define the name&lt;br /&gt;    FilePath = Environ("TEMP")&lt;br /&gt;    &lt;br /&gt;    On Error Resume Next&lt;br /&gt;    Kill FilePath &amp; "\" &amp; FileName&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    Application.DisplayAlerts = False&lt;br /&gt;    tWB.SaveAs FileName:=FilePath &amp; "\" &amp; FileName, FileFormat:=56&lt;br /&gt;    Application.DisplayAlerts = True&lt;br /&gt;     &lt;br /&gt;'Sending email through outlook&lt;br /&gt;&lt;br /&gt;    Set oApp = CreateObject("Outlook.Application")&lt;br /&gt;    Set oMail = oApp.CreateItem(0)&lt;br /&gt;    With oMail&lt;br /&gt;        .To = Mailid&lt;br /&gt;        .Subject = "Update Message Subject here"&lt;br /&gt;        .Body = Body&lt;br /&gt;        .Attachments.Add tWB.FullName&lt;br /&gt;        .send&lt;br /&gt;    End With&lt;br /&gt;     &lt;br /&gt;'Delete the temporary file and restore screen updating&lt;br /&gt;    &lt;br /&gt;    tWB.ChangeFileAccess Mode:=xlReadOnly&lt;br /&gt;    Kill tWB.FullName&lt;br /&gt;    tWB.Close SaveChanges:=False&lt;br /&gt;    cWB.Activate&lt;br /&gt;    Application.ScreenUpdating = True&lt;br /&gt;    Set oMail = Nothing&lt;br /&gt;    Set oApp = Nothing&lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/EmailActivesheetwithVBA.xls?attredirects=0&amp;d=1"&gt;Download file with VBA code to send active sheet through outlook&lt;/a&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7235845626200938262?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7235845626200938262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/07/excel-macros-send-email-with-vba.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7235845626200938262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7235845626200938262'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/07/excel-macros-send-email-with-vba.html' title='Excel Macros : Send Email with VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5331369413325928738</id><published>2010-05-31T21:16:00.000+05:30</published><updated>2010-05-31T21:17:51.467+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='calculating age'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Excel Formula : Calculating Age</title><content type='html'>Today I am sharing with a long formula for calculating age based in Date of Birth as input. &lt;br /&gt;&lt;br /&gt;=YEAR(DATE(YEAR(TODAY())-YEAR(A1),MONTH(TODAY())-MONTH(A1)+1,DAY(TODAY())-DAY(A1)+1))-1900&amp;" Years "&amp;IF(MONTH(DATE(YEAR(TODAY())-YEAR(A1),MONTH(TODAY())-MONTH(A1)+1,DAY(TODAY())-DAY(A1)+1))-1=0,"",MONTH(DATE(YEAR(TODAY())-YEAR(A1),MONTH(TODAY())-MONTH(A1)+1,DAY(TODAY())-DAY(A1)+1))-1&amp;" Months ")&amp;IF(DAY(DATE(YEAR(TODAY())-YEAR(A1),MONTH(TODAY())-MONTH(A1)+1,DAY(TODAY())-DAY(A1)+1))-1=0,"",DAY(DATE(YEAR(TODAY())-YEAR(A1),MONTH(TODAY())-MONTH(A1)+1,DAY(TODAY())-DAY(A1)+1))-1&amp;" Days")&lt;br /&gt;&lt;br /&gt;This formula calculates age of a person with the accuracy of exact years , months and days&lt;br /&gt;&lt;br /&gt;This considers that the Date of Birth is available at Cell A1 of the worksheet. You will need to replace this&lt;br /&gt;&lt;br /&gt;&lt;H3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-formulas/CalculatingAge.xls?attredirects=0&amp;d=1"&gt;Download excel file containing formula to calculate age based on Date of Birth&lt;/a&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5331369413325928738?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5331369413325928738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/05/excel-formula-calculating-age.html#comment-form' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5331369413325928738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5331369413325928738'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/05/excel-formula-calculating-age.html' title='Excel Formula : Calculating Age'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-118520081666093107</id><published>2010-04-18T14:30:00.003+05:30</published><updated>2010-04-18T14:53:55.349+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Defined Names'/><category scheme='http://www.blogger.com/atom/ns#' term='Range Name Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with Data Range'/><title type='text'>Create Range Name in Excel</title><content type='html'>Today I am sharing quickest way to create Range Name in Excel. Just 3 easy steps&lt;br /&gt;&lt;br /&gt;1. Select the cell(s) you want to name&lt;br /&gt;2. Type Range name in the name box&lt;br /&gt;3. Press Enter&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/create-range-name-in-excel.html"&gt;&lt;img border="0" alt="Create Range Name in Excel" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CreateRangeNameExcel.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;The following is a list of syntax rules that you need to be aware of when you create and edit names.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Valid characters&lt;/strong&gt; The first character of a name must be a letter, an underscore character (_), or a backslash (\). Remaining characters in the name can be letters, numbers, periods, and underscore characters.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Cell references disallowed&lt;/strong&gt; Names cannot be the same as a cell reference, such as Z$100 or R1C1. Spaces are not valid Spaces are not allowed as part of a name. Use the underscore character (_) and period (.) as word separators, such as, Sales_Tax or First.Quarter.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Name length&lt;/strong&gt; A name can contain up to 255 characters.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Case sensitivity&lt;/strong&gt; Names can contain uppercase and lowercase letters. Excel does not distinguish between uppercase and lowercase characters in names. For example, if you created the name Sales and then create another name called SALES in the same workbook, Excel prompts you to choose a unique name&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Check out screen cast below to see it happening.&lt;/b&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/create-range-name-in-excel.html"&gt;&lt;img border="0" alt="Create Range Name in Excel" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/RangeNames.gif" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;Named ranges is part of defined names in excel. It is just not limited to a cell on the worksheet or range of cells, it can also be a constant or a formula in your workbook. &lt;br /&gt;&lt;br /&gt;&lt;h3&gt;It has many uses in Excel, some of them are :-&lt;/h3&gt;&lt;br /&gt;1. Make your formulas much easier to understand.&lt;br /&gt;2. Refer to dynamic ranges in excel by &lt;a href="http://www.yogeshguptaonline.com/2008/12/defining-dynamic-ranges-range-names.html"target="_blank"&gt;creating dynamic range names&lt;/a&gt;&lt;br /&gt;3. Can be used in data validation based on contents on another worksheet&lt;br /&gt;4. Can be used for conditional formatting based on contents on another worksheet.&lt;br /&gt;5. These are best used in Excel Macros. It makes your macros more robust&lt;br /&gt;6. Use them as constant value without referring to contents on your worksheet. &lt;br /&gt;&lt;br /&gt;Will be covering some of the topics in my upcoming posts, so stay tuned to learn more uses of defined names in excel.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-118520081666093107?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/118520081666093107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/create-range-name-in-excel.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/118520081666093107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/118520081666093107'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/create-range-name-in-excel.html' title='Create Range Name in Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7918516182727459908</id><published>2010-04-10T15:21:00.003+05:30</published><updated>2010-04-17T07:48:33.465+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Add Spin Buttons ActiveX Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='Making EMI Calculator'/><title type='text'>Add Spin Buttons Active X Excel</title><content type='html'>&lt;div align="justify"&gt;In my previous posts I have shared &lt;strong&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/emi-calculator.html" target="_blank"&gt;EMI Calculator&lt;/a&gt;&lt;/strong&gt; with you. This was mode using &lt;a href="http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html"&gt;&lt;b&gt;Excel PMT function&lt;/b&gt;&lt;/a&gt; and Spin Buttons ActiveX Controls in Excel. In this post I am sharing how to add spin buttons ActiveX controls to excel worksheet.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html"&gt;&lt;img border="0" alt="Add Spin Buttons Active X Excel" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/SpinButtonsActiveX.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Step 1 &lt;a href="http://www.yogeshguptaonline.com/2010/04/show-developer-tab-in-excel-2007-ribbon.html" target="_blank"&gt;Have Developer Tab visible in your Excel 2007&lt;/a&gt;. In case you already have it proceed to step 2&lt;br /&gt;Step 2 Click on Insert under controls group&lt;br /&gt;Step 3 Click on Spin Buttons under ActiveX Controls&lt;br /&gt;Step 4 Draw Spin Button on your worksheet.&lt;br /&gt;Step 5 Rename the Spin Button Object&lt;br /&gt;Step 6 Add VBA code to the Spin Button&lt;br /&gt;&lt;br /&gt;Checkout Screen Cast Below&lt;br /&gt;&lt;/div&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html"&gt;&lt;img border="0" alt="Add Spin Buttons Active X Excel" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/AddSpinButtons.gif" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div align="justify"&gt;&lt;br /&gt;&lt;br /&gt;In this screen cast we have added spin button next to loan amount and renamed the spin button object as Loan&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;Similarly add two more spin buttons next to Interest Rate and Years. Rename them as Interest and Years respectively.&lt;br /&gt;&lt;br /&gt;To make these buttons work we need to add VBA code. Separate macros are required for each button that is why we have renamed the spin buttons. It is to give them a name that can be related later on by us when we look at the macro code. Macro code will be using the names we have given to them&lt;br /&gt;&lt;br /&gt;Now to add the VBA code , double click on the spin button object, it will open VBA editor. Copy following &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkSheet"target="_blank"&gt;VBA code to worksheet module&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="HEIGHT: 400px; OVERFLOW: auto"&gt;&lt;table bgcolor="#777777"&gt;&lt;tbody&gt;&lt;tr bgcolor="#aaaaaa"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;Private Sub Loan_SpinDown()&lt;br /&gt;    With Range("C4")&lt;br /&gt;        .Value = WorksheetFunction.Max(100000, .Value - 100000)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Loan_SpinUp()&lt;br /&gt;    With Range("C4")&lt;br /&gt;        .Value = WorksheetFunction.Min(10000000, .Value + 100000)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Interest_SpinDown()&lt;br /&gt;    With Range("C5")&lt;br /&gt;        .Value = WorksheetFunction.Max(0.03, .Value - 0.0025)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Interest_SpinUp()&lt;br /&gt;    With Range("C5")&lt;br /&gt;        .Value = WorksheetFunction.Min(0.25, .Value + 0.0025)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;Private Sub Years_SpinDown()&lt;br /&gt;    With Range("C6")&lt;br /&gt;        .Value = WorksheetFunction.Max(1, .Value - 1)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Years_SpinUp()&lt;br /&gt;    With Range("C6")&lt;br /&gt;        .Value = WorksheetFunction.Min(25, .Value + 1)&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;With this your EMI Calculator with Spin Buttons ActiveX Controls is ready&lt;br /&gt;&lt;br /&gt;Visit &lt;a href="http://www.yogeshguptaonline.com/2010/03/emi-calculator.html" target="_blank"&gt;EMI Calculator&lt;/a&gt; page if you want to download excel file complete with macros and Spin Buttons Activex controls&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7918516182727459908?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7918516182727459908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7918516182727459908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7918516182727459908'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html' title='Add Spin Buttons Active X Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5437914070115288913</id><published>2010-04-10T13:28:00.002+05:30</published><updated>2010-04-10T13:30:27.762+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Show Developer Tab'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Show Developer Tab in Excel 2007 Ribbon</title><content type='html'>In case you are working with ActiveX Controls or Macros in Excel , you need to have Developers Tab visibile in your Excel 2007. When you start using Excel 2007, developers Tab is not visible , however you can set it visible with following steps&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/show-developer-tab-in-excel-2007-ribbon.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/ShowDeveloperTabInExcel.png" border="0" alt="Show Developer Tab in Excel 2007 Ribbon"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Step 1 - Click MS Office Button&lt;br /&gt;Step 2 - Click Excel Options&lt;br /&gt;Step 3 - Click Populor&lt;br /&gt;Step 4 - Tick Show Developer Tab in the Ribbon check box&lt;br /&gt;Step 5 - Click Ok&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5437914070115288913?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5437914070115288913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/show-developer-tab-in-excel-2007-ribbon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5437914070115288913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5437914070115288913'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/show-developer-tab-in-excel-2007-ribbon.html' title='Show Developer Tab in Excel 2007 Ribbon'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-215177408654767143</id><published>2010-04-02T17:49:00.011+05:30</published><updated>2010-04-10T15:40:07.203+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PMT Function in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Making EMI Calculator'/><title type='text'>Excel Formula : PMT Function</title><content type='html'>In my previous post I shared &lt;a href="http://www.yogeshguptaonline.com/2010/03/emi-calculator.html" target="_blank"&gt;&lt;b&gt;EMI Calculator&lt;/a&gt;&lt;/b&gt; with you. In this post I am sharing how to make EMI Calculator. This has been done using &lt;a href="#PMT"&gt;PMT Function in excel&lt;/a&gt; to calculate EMI amount and Spin Buttons ActiveX Controls to fine tune the amounts.&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/emi-calculator.html" target="_blank"&gt;&lt;img alt="EMI Calculator" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/EMICalculator.gif" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name="PMT"&gt;&lt;/a&gt;&lt;h3&gt;&lt;a href="#PMT"&gt;Using PMT Function in Excel&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;PMT Function Calculates the payment for a loan based on constant payments and a constant interest rate. For calculating EMI you need 3 inputs.&lt;br /&gt;&lt;br /&gt;Loan Amount , Annual Interest Rate, Loan Period in Years. Using these figures EMI can be calculated with PMT Function in Excel&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html"&gt;&lt;img alt="EMI Calculator" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/EMICalculator-1-1.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;Syntax : PMT(RATE,NPER,PV,FV,TYPE)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;RATE :&lt;/b&gt; is the interest rate for the loan. In case you are making monthly payments devide the annual rate by 12 to get monthly rate.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NPER :&lt;/b&gt; is the total number of payments for the loan. When payments are made on monthly basis you need to multiply number of years with 12 to arrive at total number of payments.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PV :&lt;/b&gt; is the present value, or the total amount that a series of future payments is worth now; also known as the principal. We take this figure as (-) Negative in our formula since it is receipt of funds.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;FV :&lt;/b&gt; is the future value, or a cash balance you want to attain after the last payment is made. If fv is omitted, it is assumed to be 0 (zero), that is, the future value of a loan is 0. In our formula we omit this figure as we need to reach zero balance at the end of term.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Type :&lt;/b&gt; is the number 0 (zero) or 1 and indicates when payments are due. If payments are due at the end of the period use 0 or omit this figure. use 1 if payments are made at the beginning of the period. In our formula we have omitted this.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;We have calculated our figures with following formulas &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;EMI :&lt;/b&gt; =PMT(Interst/12,Years*12,-LoanAmt)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Total Amount with Interest &lt;/b&gt;- This is total outgo during the loan term. This can be calculated using : = EMI*Years*12&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Flat Interest Rate :&lt;/b&gt; = (Total Amount with Interest - LoanAmt)/LoanAmt/Years : Many financiers talk about Flat interest rate while landing money. They calculate simple interest on entire loan amount for entire period of the loan. Many people go for the loan without understanding the actual interest rate. Flat interest rate looks very attractive as it is much lower than the actual interest rate which is calculated on reducing balance. You can see the difference in the figures above. So be careful while borrowing on flat interest rate.&lt;br /&gt;&lt;br /&gt;In next post I will cover &lt;a href="http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html"target="_blank"&gt;Adding Spin Buttons ActiveX Controls to Worksheet&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-215177408654767143?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/215177408654767143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/215177408654767143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/215177408654767143'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html' title='Excel Formula : PMT Function'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6281413217778504964</id><published>2010-03-22T09:11:00.004+05:30</published><updated>2010-04-10T15:39:04.951+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='EMI Calculator'/><title type='text'>EMI Calculator</title><content type='html'>My friend is taking a loan to buy a house and he asked me what will be my EMI. He knew following figures and was curious to know his EMI&lt;br /&gt;&lt;br /&gt;Loan Amount&lt;br /&gt;Annual Interest Rate&lt;br /&gt;Loan Period - Years&lt;br /&gt;&lt;br /&gt;I quickly calculated EMI using &lt;a href="http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html" target="_blank"&gt;PMT function in excel&lt;/a&gt;. This triggered me an idea of making a EMI calculator and sharing it with all of you.&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/emi-calculator.html"&gt;&lt;img alt="EMI Calculator" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/EMICalculator-1.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Equated Monthly Installments are commonly knows as EMI. As per business dictionary EMI is "Hire purchase, lease, or loan -repayment installments that are constant in amount, and are usually collected in advance as post-dated checks"&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-formulas/EMICalculator.xls?attredirects=0&amp;amp;d=1"&gt;&lt;h3&gt;Download EMI Calculator Excel file to know your EMI&lt;/h3&gt;&lt;/a&gt;Input your figures to find out resultant EMI. Use spin buttons to fine tune your results&lt;br /&gt;&lt;br /&gt;In next post I will discuss how to make EMI Calculator. This will be about &lt;a href="http://www.yogeshguptaonline.com/2010/04/add-spin-buttons-active-x-excel.html"target="_blank"&gt;adding Spin Buttons ActiveX controls to worksheet&lt;/a&gt; and &lt;a href="http://www.yogeshguptaonline.com/2010/04/excel-formula-pmt-function.html" target="_blank"&gt;PMT function&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6281413217778504964?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6281413217778504964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/emi-calculator.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6281413217778504964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6281413217778504964'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/emi-calculator.html' title='EMI Calculator'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7688670895576787798</id><published>2010-03-17T18:09:00.002+05:30</published><updated>2010-03-17T18:13:10.313+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='subtotal in excel'/><category scheme='http://www.blogger.com/atom/ns#' term='subtotal excel'/><category scheme='http://www.blogger.com/atom/ns#' term='subtotal function excel'/><category scheme='http://www.blogger.com/atom/ns#' term='excel subtotals'/><category scheme='http://www.blogger.com/atom/ns#' term='subtotals in excel'/><title type='text'>Excel Formula : Subtotal Excel</title><content type='html'>Most of the time in our reporting we need to do subtotals followed by Grand total at the end of report. I have seen many people using SUM function for subtotals in between and then adding individual cells for calculating grand total at the end. There is nothing wrong with this method if you use it very carefully so that you do not miss any item while calculating grand total at the end. &lt;br /&gt;&lt;br /&gt;However better approach is to use Excel Subtotal function for calculating Subtotal and Grand Totals. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-formula-subtotal-excel.html" &gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/subtotal.png" border="0" alt="Subtotal Excel"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Image above is showing column B with the Subtotal formula and resultant values with this formula. You may notice that when we use subtotal function for calculating Grand Total, it ignores the values resulting from subtotal function within its range. This method ensures that we do not miss any item while doing Grand Totals for our reports thus higher accuracy. &lt;br /&gt;&lt;br /&gt;This becomes more helpful when you edit your report after some time to insert another subtotal. You do not need to remember to correct the final formula calculating the Grand Total.&lt;br /&gt;&lt;br /&gt;Another advantage of using Subtotal function is that you need not to recalculate your formulas when used with filteres. This function ignores the values hidden by the filters and considers the values in the visible rows only.&lt;br /&gt;&lt;br /&gt;Subtotal can be used for various type of calculations based on what do you want this fucntion to do for you. Syntex for this function is &lt;br /&gt;&lt;br /&gt;SUBTOTAL(function_num, ref1, ref2, ...)&lt;br /&gt;&lt;br /&gt;Following function numbers can be used in Subtotal function&lt;br /&gt;&lt;br /&gt;I have used "9" in my example above for sum you can change it as per your required working.&lt;br /&gt;&lt;br /&gt;&lt;table width="80%" border="1" align="Center" cellspacing="0" cellpadding="0"&gt;&lt;tr class="trbgeven"&gt;&lt;th ALIGN="center" WIDTH="35%"&gt; Function_num&lt;br&gt; (Incl hidden values)&lt;/th&gt;&lt;th ALIGN="center" WIDTH="35%"&gt;Function_num&lt;br&gt; (Excl hidden values)&lt;/th&gt;&lt;th WIDTH="30%" ALIGN="center"&gt;Function&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr class="trbgodd"&gt;&lt;td ALIGN="center"&gt;1&lt;/td&gt;&lt;td ALIGN="center"&gt;101&lt;/td&gt;&lt;td ALIGN="center"&gt;AVERAGE&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgeven"&gt;&lt;td ALIGN="center"&gt;2&lt;/td&gt;&lt;td ALIGN="center"&gt;102&lt;/td&gt;&lt;td ALIGN="center"&gt;COUNT&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgodd"&gt;&lt;td ALIGN="center"&gt;3&lt;/td&gt;&lt;td ALIGN="center"&gt;103&lt;/td&gt;&lt;td ALIGN="center"&gt;COUNTA&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgeven"&gt;&lt;td ALIGN="center"&gt;4&lt;/td&gt;&lt;td ALIGN="center"&gt;104&lt;/td&gt;&lt;td ALIGN="center"&gt;MAX&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgodd"&gt;&lt;td ALIGN="center"&gt;5&lt;/td&gt;&lt;td ALIGN="center"&gt;105&lt;/td&gt;&lt;td ALIGN="center"&gt;MIN&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgeven"&gt;&lt;td ALIGN="center"&gt;6&lt;/td&gt;&lt;td ALIGN="center"&gt;106&lt;/td&gt;&lt;td ALIGN="center"&gt;PRODUCT&lt;/td&gt;&lt;/tr&gt;&lt;tr class="trbgodd"&gt;&lt;td ALIGN="center"&gt;7&lt;/td&gt;&lt;td ALIGN="center"&gt;107&lt;/td&gt;&lt;td ALIGN="center"&gt;STDEV&lt;/td&gt;&lt;/tr&gt;&lt;tr ALIGN="center" class="trbgeven"&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;108&lt;/td&gt;&lt;td&gt;STDEVP&lt;/td&gt;&lt;/tr&gt;&lt;tr ALIGN="center" class="trbgodd"&gt;&lt;td&gt;9&lt;/td&gt;&lt;td&gt;109&lt;/td&gt;&lt;td&gt;SUM&lt;/td&gt;&lt;/tr&gt;&lt;tr ALIGN="center" class="trbgeven"&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;110&lt;/td&gt;&lt;td&gt;VAR&lt;/td&gt;&lt;/tr&gt;&lt;tr ALIGN="center" class="trbgodd"&gt;&lt;td&gt;11&lt;/td&gt;&lt;td&gt;111&lt;/td&gt;&lt;td&gt;VARP&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7688670895576787798?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7688670895576787798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/excel-formula-subtotal-excel.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7688670895576787798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7688670895576787798'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/excel-formula-subtotal-excel.html' title='Excel Formula : Subtotal Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-4614213842504019019</id><published>2010-03-08T22:08:00.001+05:30</published><updated>2010-03-08T22:13:08.505+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Currency Format'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Number Format'/><category scheme='http://www.blogger.com/atom/ns#' term='Formating Numbers in Excel'/><title type='text'>Format Numbers : Excel Currency Format</title><content type='html'>You can add currency symbol to your numbers in excel.&lt;br /&gt;&lt;br /&gt;Open Number Format dialog box using Format Cells option or just press Ctrl+1&lt;br /&gt;&lt;br /&gt;1. Click Accounting&lt;br /&gt;2. Choose currency symbol from drop down&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/format-numbers-excel-currency-format.html"&gt;&lt;img alt="Format Numbers : Excel Currency Format" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/AddCurrencySymbol.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;In case you do not get your currency symbol from drop down, add your symbol using custom formating option in the same dialogbox&lt;br /&gt;1. Click Custom&lt;br /&gt;2. Type - "Rs "#,##0_);[Red]("Rs "#,##0)&lt;br /&gt;&lt;br /&gt;I use "Rs " to show numbers in Indian Currency. You can replace it with your symblol.&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/format-numbers-excel-currency-format.html"&gt;&lt;img alt="Format Numbers : Excel Currency Format" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/AddCurrencySymbol2.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-4614213842504019019?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/4614213842504019019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/format-numbers-excel-currency-format.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4614213842504019019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4614213842504019019'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/format-numbers-excel-currency-format.html' title='Format Numbers : Excel Currency Format'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3345999191485490637</id><published>2010-03-07T19:11:00.006+05:30</published><updated>2010-03-25T05:58:31.236+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Profit and Loss report using Pivot Tables'/><category scheme='http://www.blogger.com/atom/ns#' term='Pivot Tables'/><title type='text'>Pivot Tables : P&amp;L reporting for Multi Location Organisation</title><content type='html'>I have recently started a series via guest posts on &lt;a href="http://chandoo.org/wp/" target="_blank"&gt;pointy haired dilbert&lt;/a&gt; famous excel blog also known as PHD or &lt;a href="http://chandoo.org/wp/" target="_blank"&gt;Chandoo.org&lt;/a&gt;. This blog is run by Chandoo a excel blogger and &lt;a href="https://mvp.support.microsoft.com/profile/Purnachandra.Duggirala" target="_blank"&gt;Microsoft excel MVP&lt;/a&gt;. Most of you must be knowing chandoo, those who do not know about him can &lt;a href="http://chandoo.org/wp/about" target="_blank"&gt;know more about chandoo&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;In this series we are covering on how to manage Profit and Loss (P&amp;amp;L) account reporting for Multi Location organization.&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/pivot-tables-p-reporting-for-multi.html" target="_blank"&gt;&lt;img alt="P&amp;amp;L Report using Pivot Table" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/profit-loss-report-with-calculated-.png" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;During this series our aim is to learn how we can do our P&amp;amp;L reporting on various dimensions with few clicks.&lt;br /&gt;&lt;br /&gt;We are using Pivot Tables for our reporting purpose and will setup P&amp;amp;L report of a Retails chain with multiple locations divided into various regions.&lt;br /&gt;&lt;br /&gt;Topics coverted in this series are :&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;/strong&gt;&lt;a href="http://chandoo.org/wp/2010/02/04/profit-loss-reporting-in-excel-1/" target="_blank"&gt;&lt;strong&gt;Data sheet structure for Preparing P&amp;amp;L using Pivot Tables&lt;/strong&gt; &lt;/a&gt;&lt;br /&gt;&lt;strong&gt;2. &lt;/strong&gt;&lt;a href="http://chandoo.org/wp/2010/02/10/profit-loss-reports-excel-2/" target="_blank"&gt;&lt;strong&gt;Preparing P&amp;amp;L Pivot Table using Data sheet&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;3. &lt;/strong&gt;&lt;a href="http://chandoo.org/wp/2010/02/25/p-l-reports-calculated-fields-3/" target="_blank"&gt;&lt;strong&gt;Adding Calculated Fields to Pivot Table P&amp;amp;L&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;&lt;a href="http://chandoo.org/wp/2010/03/03/explore-profit-loss-reports-4/" target="_blank"&gt;&lt;strong&gt;Exploring Pivot Table P&amp;amp;L Reports&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br /&gt;5. &lt;strong&gt;&lt;a href="http://chandoo.org/wp/2010/03/24/qtrly-half-yearly-pl-reports-5/"target="_blank"&gt;Preparing Quarterly and Half yearly P&amp;amp;L using grouping option&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;6. Budget V/s Actual report using Pivot&lt;br /&gt;&lt;br /&gt;Do not think that series is only about the Profit and Loss Account. This series is also about PivotTables. We will cover many of PivotTable tricks during our series. I hope you will be able to use those tricks elsewhere also.&lt;br /&gt;&lt;br /&gt;Follow this series on &lt;a href="http://chandoo.org/wp/" target="_blank"&gt;PHD&lt;/a&gt;, I am sure that at the end of this series you will be able to do your P&amp;amp;L reporting on various dimentions with just few clicks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3345999191485490637?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3345999191485490637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/pivot-tables-p-reporting-for-multi.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3345999191485490637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3345999191485490637'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/pivot-tables-p-reporting-for-multi.html' title='Pivot Tables : P&amp;L reporting for Multi Location Organisation'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8605423537359261768</id><published>2010-03-04T11:52:00.003+05:30</published><updated>2010-03-04T11:58:26.889+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Deploy Macros Found Elsewhere'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel VBA : Deploy Macros Found Elsewhere</title><content type='html'>Today I am sharing various ways to add macros found elsewhere to a Excel file where that macro is to be deployed. Will be covering 6 ways to add macro code to your excel file.&lt;br /&gt;&lt;br /&gt;1. &lt;a href="#Regular"&gt;Excel VBA : Add code to a Regular Module&lt;/a&gt;&lt;br /&gt;2. &lt;a href="#WorkBook"&gt;Excel VBA : Add code to WorkBook Module&lt;/a&gt;&lt;br /&gt;3. &lt;a href="#WorkSheet"&gt;Excel VBA : Add code to Worksheet Module&lt;/a&gt;&lt;br /&gt;4. &lt;a href="#CopyModule"&gt;Excel VBA : Copy Module from Existing Workbook&lt;/a&gt;&lt;br /&gt;5. &lt;a href="#CopyForm"&gt;Excel VBA : Copy Forms from Existing Workbook&lt;/a&gt;&lt;br /&gt;6. &lt;a href="#ImportBAS"&gt;Excel VBA : Import code from .bas file&lt;/a&gt;&lt;br /&gt;&lt;a name="Regular"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#Regular"&gt;Excel VBA : Add code to a Regular Module&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;-Copy code from the source&lt;br /&gt;-Open the workbook where you need to deploy this code&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-Click Insert &gt; Module (Shortcut ALT+I+M)&lt;br /&gt;-Paste macro code Click Edit &gt; Paste (Shortcut CTRL+V) in right window where cursor is&lt;br /&gt;&lt;br /&gt;See screencast below for Alternate method using right click menu through mouse.&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CopytoRegularModule.gif" border="0" alt="Excel VBA : Add code to a Regular Module"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="WorkBook"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#Workbook"&gt;Excel VBA : Add code to WorkBook Module&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;Some macros are event based macros and get activated as soon as particular event happens. Events which are universally applicable to the entire workbook are called workbook events. These macros will run once a particular event happens in a particular workbook. Typical example of such macros are Auto Open / Auto Close macros&lt;br /&gt;&lt;br /&gt;-Copy code from the source&lt;br /&gt;-Open the workbook where you need to deploy this&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-Double Click on ThisWorkbook object&lt;br /&gt;-Paste macro code Click Edit &gt; Paste (Shortcut CTRL+V) in right window where cursor is&lt;br /&gt;&lt;br /&gt;See screencast below&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Workbook"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CopytoThisWorkbook.gif" border="0" alt="Excel VBA : Add code to WorkBook Module"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="WorkSheet"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#WorkSheet"&gt;Excel VBA : Add code to Worksheet Module&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;Some of event based macros get activated as soon as particular event happens on a particular worksheet within the workbook. These are the macros which will run on a event in particular worksheet. Typical example of such macros are Worksheet Select / Worksheet Change macros&lt;br /&gt;&lt;br /&gt;-Copy code from the source&lt;br /&gt;-Open the workbook where you need to deploy this&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-Double Click on Worksheet object (Choose particular worksheet where you want to deploy the code)&lt;br /&gt;-Paste macro code Click Edit &gt; Paste (Shortcut CTRL+V) in right window where cursor is&lt;br /&gt;&lt;br /&gt;See screencast below&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkSheet"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CopytoWorksheetModule.gif" border="0" alt="Excel VBA : Add code to Worksheet Module"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="CopyModule"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#CopyModule"&gt;Excel VBA : Copy Module from Existing Workbook&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;You may have the code in existing workbook (Source) with you or recently downloaded from Internet. Following steps will deploy it to new workbook (Target)&lt;br /&gt;-Open both the Workbooks (Source and Target)&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-In Left window of project explorer find Source workbook&lt;br /&gt;-Select the source module&lt;br /&gt;-Drag it to the Target workbook&lt;br /&gt;&lt;br /&gt;See screencast below&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#CopyModule"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CopyFromAnotherWorkbook.gif" border="0" alt="Excel VBA : Copy Module from Existing Workbook"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="CopyForm"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#CopyForm"&gt;Excel VBA : Copy Forms from Existing Workbook&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;Steps and requirement is similar to copy code from existing workbook&lt;br /&gt;&lt;br /&gt;-Open both the Workbooks (Source and Target)&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-In Left window of project explorer find Source workbook&lt;br /&gt;-Select the Form to be copied&lt;br /&gt;-Drag it to the Target workbook&lt;br /&gt;&lt;br /&gt;See screencast below&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#CopyForm"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CopyFormsfromAnotherWorkbook.gif" border="0" alt="Excel VBA : Copy Forms from Existing Workbook"&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name="ImportBAS"&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;a href="#ImportBAS"&gt;Excel VBA : Import code from .bas file&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:140%;"&gt;&lt;/span&gt;&lt;br /&gt;Some time you may get code in downloadable file with extention BAS. This is visual basic file .bas , you can import this to your workbook. &lt;br /&gt;&lt;br /&gt;-Open your Workbook&lt;br /&gt;-Press ALT+F11 (Keep ALT key pressed while pressing F11 key)&lt;br /&gt;-In Left window of project explorer find Source workbook&lt;br /&gt;-Click File &gt; Import (CTRL+M)&lt;br /&gt;-Choose downloaded VB file (*.BAS , *.FRM, *.CLS)&lt;br /&gt;-Click Open&lt;br /&gt;&lt;br /&gt;See screencast below&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#ImportBAS"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/ImportVBACodeFromFile.gif" border="0" alt="Excel VBA : Import code from .bas file"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8605423537359261768?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8605423537359261768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#comment-form' title='28 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8605423537359261768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8605423537359261768'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html' title='Excel VBA : Deploy Macros Found Elsewhere'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>28</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1063086895511306071</id><published>2010-02-12T07:51:00.003+05:30</published><updated>2010-02-12T15:00:42.917+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sorting Dates by Birthday'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Excel Sort Dates by Birthday</title><content type='html'>Today's post is in &lt;a href="http://www.yogeshguptaonline.com/2009/02/custom-formating-date-format.html?showComment=1265919839549#c8567151039386470643" target="_blank"&gt;response to comment&lt;/a&gt; by Donna.&lt;br /&gt;&lt;br /&gt;Problem on hand is to sort data based on birthday of a person. If you sort it on the date of birth it has year also and you will not be able to sort them by month and date.&lt;br /&gt;&lt;br /&gt;One of the possible solution is to drop the Year and then sort them. You will need to add one more column to your data as sort key and use following formula considering that you have Date of Birth in Cell "B2"&lt;br /&gt;&lt;br /&gt;=TEXT(B2,"MMDD") will convert 02-Dec-50 as 1202 and 24-Sep-89 as 0924. Now if you sort your data based on new column "Sort Key" on ascending manner, you will get 24-Sep-89 before 02-Dec-50&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/02/excel-sort-dates-by-birthday.html" target="_blank"&gt;&lt;img alt="Photobucket" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/Sortingdatesondateofbirth.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;You will be able to get this result only if the date of birth in your data is a real date. In case not you will need to &lt;a href="http://www.yogeshguptaonline.com/2009/10/excel-convert-text-to-date.html"target="_Blank"&gt;convert text date to real dates&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Use following formula to know Birthday during current year &lt;br /&gt;&lt;br /&gt;=--TEXT(B2,"DD/MMM")&lt;br /&gt;&lt;br /&gt;You will get error in case birthday is 29-Feb and current year is not a leap year. I suppose this is correct as person will not have birthday every year.&lt;br /&gt;&lt;br /&gt;There are couple of other solutions to the sort dates on birthday , you can share one by way of comments if you know&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1063086895511306071?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1063086895511306071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/02/excel-sort-dates-by-birthday.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1063086895511306071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1063086895511306071'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/02/excel-sort-dates-by-birthday.html' title='Excel Sort Dates by Birthday'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-23291451363166412</id><published>2010-02-01T23:31:00.001+05:30</published><updated>2010-02-06T21:08:55.785+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sum Top 5 values in Unsorted Range'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><title type='text'>Excel Formula : Sum top 5 in unsorted range</title><content type='html'>Today I am sharing a formula to sum top 5 values in an unsorted range. &lt;br /&gt;&lt;br /&gt;=SUMPRODUCT(LARGE(Data,ROW(1:5)))&lt;br /&gt;&lt;br /&gt;See the screen cast below to know secret behind this formula.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/02/excel-formula-sum-top-5-in-unsorted.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/SumTop5inunsortedrange.gif" border="0" alt="Photobucket"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Actually we are using array formula to find top 5 values , then summing them to find the sum of top 5 values in unsorted range.&lt;br /&gt;&lt;br /&gt;From the screen cast you can see that &lt;br /&gt;&lt;br /&gt;1. We are entering this formula using sumproduct, which is shortcut to enter array formulas in excel. &lt;br /&gt;2. Data is a named range A3 to B36&lt;br /&gt;3. We are using excel function Large to find Top values.&lt;br /&gt;4. Row(1:5) - is is shortcut to create an array of numbers {1,2,3,4,5} as Kth position &lt;br /&gt;&lt;br /&gt;This leads to find top 5 values in unsorted range and then summing them.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Food for thought :&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Just change Row(1:5) to Row(1:10) you will be able to find Top 10 values.&lt;br /&gt;&lt;br /&gt;Or Change Large with small to find out bottom 5 values.&lt;br /&gt;&lt;br /&gt;&lt;H3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-formulas/sumtop5inunsortedrange.xls?attredirects=0&amp;d=1"&gt;Download Excel file with formula to sum top 5 values in an unsorted range&lt;/a&gt;&lt;/H3&gt; to play furhter with this formula&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-23291451363166412?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/23291451363166412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/02/excel-formula-sum-top-5-in-unsorted.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/23291451363166412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/23291451363166412'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/02/excel-formula-sum-top-5-in-unsorted.html' title='Excel Formula : Sum top 5 in unsorted range'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6746062816988202564</id><published>2010-01-16T22:05:00.002+05:30</published><updated>2010-01-16T22:10:45.854+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Closest Match'/><title type='text'>Excel Formula : Closest Match</title><content type='html'>Arun Singla one of my blog reader has sent me Excel Formula in response to my previous post &lt;a href="http://www.yogeshguptaonline.com/2010/01/custom-function-excel-closest-match.html" target="_blank"&gt;Custom Function : Excel Closest Match using VBA&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Formula sent by Arun gives similar results as achieved by Custom Function using VBA. I am sharing the formula with you.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;For getting less than equal to value&lt;/strong&gt;&lt;br /&gt;=IF(COUNTIF(Data,Target)&gt;=1,Target,SMALL(Data,COUNTIF(Data,"&lt;"&amp;amp;Target))) &lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;For getting greater than equal to value&lt;/strong&gt;&lt;br /&gt;=IF(COUNTIF(Data,Target)&gt;=1,Target,LARGE(Data,COUNTIF(Data,"&gt;"&amp;amp;Target)))&lt;br /&gt;&lt;br /&gt;In above formula : Data is unsorted data range name, target is the named range having target value.&lt;br /&gt;&lt;br /&gt;Now let me explain how does this formula works. I will explain first formula which calculates less than equal to value.&lt;br /&gt;&lt;br /&gt;Step 1 - Formula calculates the number of values matching target value using countif function of excel. COUNTIF(Data,Target) gives the total number of values matching exactly with the target. In case you get even one value matching with the target, you return the target as closest match, no need for further working.&lt;br /&gt;&lt;br /&gt;Step 2 - In case formula does not get matching value at step 1 , it moves to find the closest match. SMALL(Data,COUNTIF(Data,"&lt;"&amp;amp;Target)) Returns the k-th smallest value in a data set. COUNTIF(Data,"&lt;"&amp;amp;Target) gives us total number of data points less than target. We are using this as k-th smallest value which is closest match less than the target value. I hope this explanation is not confusing to you. Check out the &lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-formulas/CMATCH.xls?attredirects=0&amp;amp;d=1"&gt;file with this formula to find closest match in excel&lt;/a&gt; to understand it better.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6746062816988202564?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6746062816988202564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/excel-formula-closest-match.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6746062816988202564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6746062816988202564'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/excel-formula-closest-match.html' title='Excel Formula : Closest Match'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8018143693738503276</id><published>2010-01-14T18:37:00.004+05:30</published><updated>2010-03-05T17:00:49.686+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Closest Match'/><title type='text'>Custom Function : Excel Closest Match using VBA</title><content type='html'>Some days back I got a mail from Kevin asking for how to get closest match in a list sorted in acending order&lt;br /&gt;&lt;div style="hight: 200px,width=180px"&gt;&lt;table bgcolor="#cccc99"&gt;&lt;tbody&gt;&lt;tr style="WORD-BREAK: break-all"&gt;&lt;tr bgcolor="#cccc99"&gt;&lt;pre&gt;&lt;br /&gt;Hi Yogesh, is there a way for me to find the&lt;br /&gt;closest match (greater than or equal to) to&lt;br /&gt;a value in a list? The list is sorted in&lt;br /&gt;ascending order and cannot be changed.&lt;br /&gt;Regards,&lt;br /&gt;Kevin&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;I responded to him with a Custom Function capable to Finding Closest Match as per his requirement. This worked as the list was sorted in ascending order. He sent me a thanks note for this.&lt;br /&gt;&lt;br /&gt;However this left certain questions in my mind such as&lt;br /&gt;&lt;br /&gt;1. What if the list is not sorted, Custom function should be able to do this in unsorted list.&lt;br /&gt;&lt;br /&gt;2. He wanted greater than equal to value, however it should be able to handle less than equal to value also&lt;br /&gt;&lt;br /&gt;With these things in my mind I worked out another custom function which works with unsorted data range and is capable of finding both type of closest match in excel.&lt;br /&gt;&lt;br /&gt;I am sharing updated Custom Function with all of you. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt;copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="OVERFLOW: auto; HEIGHT: 400px"&gt;&lt;table bgcolor="#777777"&gt;&lt;tbody&gt;&lt;tr bgcolor="#aaaaaa"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;Function cmatch(ByVal n, l As Range, Optional Switch As Integer = 1)&lt;br /&gt;'**************************************************************************************&lt;br /&gt;'* Custom Function by Yogesh Gupta , yogesh@yogeshguptaonline.com                     *&lt;br /&gt;'* Custom Function to find Closest Match in an unsorted data                          *&lt;br /&gt;'* use Switch value as -1 in case you want less than equal to closest match           *&lt;br /&gt;'* Default value for Switch is 1, and will find greater than equal to closest match   *&lt;br /&gt;'**************************************************************************************&lt;br /&gt;&lt;br /&gt;If Switch = 1 Then               ' This will get greater than equal to value&lt;br /&gt;        &lt;br /&gt;        a = Application.Max(l)&lt;br /&gt;        If a &lt; n Then            ' Error in case list does not have value greater than or equal to n&lt;br /&gt;            cmatch = "#N/A"&lt;br /&gt;        Else&lt;br /&gt;            For Each c In l&lt;br /&gt;                If c &gt;= n Then&lt;br /&gt;                    If c &lt; a Then a = c&lt;br /&gt;                End If&lt;br /&gt;            Next c&lt;br /&gt;            cmatch = a&lt;br /&gt;        End If&lt;br /&gt;        &lt;br /&gt;ElseIf Switch = -1 Then          ' This will get less than equal to value&lt;br /&gt;&lt;br /&gt;        a = Application.Min(l)&lt;br /&gt;        If a &gt; n Then            ' Error in case list does not have value less than or equal to n&lt;br /&gt;            cmatch = "#N/A"&lt;br /&gt;        Else&lt;br /&gt;        &lt;br /&gt;        For Each c In l&lt;br /&gt;            If c &lt;= n Then&lt;br /&gt;                If c &gt; a Then a = c&lt;br /&gt;            End If&lt;br /&gt;        Next c&lt;br /&gt;        &lt;br /&gt;        cmatch = a&lt;br /&gt;        End If&lt;br /&gt;       &lt;br /&gt;Else&lt;br /&gt;&lt;br /&gt;        cmatch = "#N/A"            ' Error in case of Invalid Input&lt;br /&gt;&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/closestmatch.xls?attredirects=0&amp;amp;d=1"&gt;Download Excel file with Custom Function to Find Closest Match to see how it works&lt;/a&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8018143693738503276?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8018143693738503276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/custom-function-excel-closest-match.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8018143693738503276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8018143693738503276'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/custom-function-excel-closest-match.html' title='Custom Function : Excel Closest Match using VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5378915991186336663</id><published>2010-01-01T13:10:00.005+05:30</published><updated>2010-03-05T16:59:32.870+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Pop up Calendar'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Date Picker'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macros : Excel Date Picker</title><content type='html'>This is first post of the year 2010, I wish all my blog readers a very happy and prospurous year. Today I am sharing Excel Date Picker Utility with you. Following picture will demonstrate some to the capabilities of this utility.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2010/01/excel-macros-excel-date-picker.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/datepicker.gif" border="0" alt="Photobucket"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sz2Mybp42UI/AAAAAAAAAMY/2sMXvdXc_7I/s1600-h/Date+Picker.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5421644324468742466" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 298px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sz2Mybp42UI/AAAAAAAAAMY/2sMXvdXc_7I/s400/Date+Picker.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This utility will help you with following&lt;br /&gt;&lt;br /&gt;1. In case you select a cell with date, or select any cell around the cell with a date. It will show floating button on the left side of the cell. If you click on the floating button it will show popup calender.&lt;br /&gt;2. In case the cell already has a date , the calendar will show same date by default, else it will show current date.&lt;br /&gt;3. You can jump the months by click on the month value on the popup calendar.&lt;br /&gt;4. Click on the year will show spin buttons next to it and you can change year easily with spin buttons.&lt;br /&gt;5. When you click on the date in popup calander, it will insert date clicked to the selected cell&lt;br /&gt;6. You can also use Ctrl+Shift+d to show popup calender on your screen.&lt;br /&gt;7. In case you get pop up calander and you do not want to click any date, just press Esc to close the pou up calendar.&lt;br /&gt;&lt;br /&gt;This utility could be usefull in following ways&lt;br /&gt;&lt;br /&gt;1. Many people end up entering date in text format as some time it is difficult to enter the date in correct computer readable format. With the popup calander, system takes care of the proper date entry.&lt;br /&gt;2. Some times you have to get data from other users and you want them to enter dates in proper format so that rest of the worksheet can use those date inputs. With this utility you can be assured about this issue.&lt;br /&gt;&lt;br /&gt;You may figure out many more usage based on your needs. The VBA code for Excel date Picker is available in the downloadable file. You can further modify the code as per your needs.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Now how to use this Excel Date Picker Utility &lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;1. Download file and save it as Excel Addin on your machine.&lt;br /&gt;2. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkSheet" target="_blank"&gt; copy this code to worksheet module&lt;/a&gt; of your workbook.&lt;br /&gt;&lt;br /&gt;You will need to add this code to show the Floating button. This code will creat the button in case it does not exist on it. All other features like cell menu on right click and popup calender on Ctrl+Shift+d will be available in case you do not add this code by saving download able file as Excel Addin on your machine. I am suggesting this because I still need to learn how to trigger worksheet selection change event with a vba code in addin.&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Private Sub FloatingButton_Click()&lt;br /&gt;Calander.Show&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Worksheet_SelectionChange(ByVal Target As Range)&lt;br /&gt;        &lt;br /&gt;    If Application.CutCopyMode = 1 Then&lt;br /&gt;    Exit Sub&lt;br /&gt;    ElseIf Target.Cells.Count &gt; 1 Then&lt;br /&gt;    Exit Sub&lt;br /&gt;    Else&lt;br /&gt;    &lt;br /&gt;        Set r = Target&lt;br /&gt;        Hasdate = 0&lt;br /&gt;&lt;br /&gt;        For x = -1 To 1&lt;br /&gt;        For y = -1 To 1&lt;br /&gt;&lt;br /&gt;        On Error GoTo Etrap1&lt;br /&gt;&lt;br /&gt;        If IsDate(r.Offset(x, y)) Then&lt;br /&gt;            Hasdate = 1&lt;br /&gt;            Exit For&lt;br /&gt;        End If&lt;br /&gt;Rsume1:&lt;br /&gt;        Next y&lt;br /&gt;        If Hasdate = 1 Then Exit For&lt;br /&gt;Rsume:&lt;br /&gt;        Next x&lt;br /&gt;            &lt;br /&gt;            If Hasdate = 1 Then&lt;br /&gt;                &lt;br /&gt;                FloatingButton.Left = r.Offset(0, 1).Left&lt;br /&gt;                FloatingButton.Top = r.Top&lt;br /&gt;                FloatingButton.Visible = True&lt;br /&gt;                &lt;br /&gt;            Else&lt;br /&gt;                &lt;br /&gt;                If Not FloatingButton.Visible = False Then&lt;br /&gt;                FloatingButton.Visible = False&lt;br /&gt;                End If&lt;br /&gt;             &lt;br /&gt;            End If&lt;br /&gt;    &lt;br /&gt;Exit Sub&lt;br /&gt;    &lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;Etrap1:&lt;br /&gt;    If r.Row = 1 Then&lt;br /&gt;        Resume Rsume&lt;br /&gt;    ElseIf r.Column = 1 Then&lt;br /&gt;        Resume Rsume1&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Worksheet_Activate()&lt;br /&gt;    Dim s As String&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    s = ActiveSheet.FloatingButton.Caption&lt;br /&gt;    If Err.Number &lt;&gt; 0 Then&lt;br /&gt;    ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _&lt;br /&gt;        , DisplayAsIcon:=False, Left:=147.75, Top:=34.5, Width:=15.75, Height:= _&lt;br /&gt;        15.75).Select&lt;br /&gt;    &lt;br /&gt;    Selection.Name = "FloatingButton"&lt;br /&gt;    ActiveSheet.OLEObjects("FloatingButton").Object.Caption = ""&lt;br /&gt;    ActiveSheet.OLEObjects("FloatingButton").Object.BackColor = &amp;H80000005&lt;br /&gt;    Range("A1").Select&lt;br /&gt;    FloatingButton.Visible = False&lt;br /&gt;    End If&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;However this will not work on the files you send to other users. In that case you need to builtin the entire utility into the file you are sending out.&lt;br /&gt;&lt;br /&gt;Following steps will help you to do this.&lt;br /&gt;&lt;br /&gt;1. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Workbook" target="_blank"&gt; copy this code to workbook module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;    Dim NewControl As CommandBarControl&lt;br /&gt;    Application.OnKey "+^{D}", "Module1.ShowCalander"&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    Application.CommandBars("Cell").Controls("Show Date Picker").Delete&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    Set NewControl = Application.CommandBars("Cell").Controls.Add&lt;br /&gt;    With NewControl&lt;br /&gt;        .Caption = "Show Date Picker"&lt;br /&gt;        .OnAction = "Module1.ShowCalander"&lt;br /&gt;        .BeginGroup = True&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_BeforeClose(Cancel As Boolean)&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    Application.CommandBars("Cell").Controls("Show Date Picker").Delete&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module - Module1 &lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 200px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long&lt;br /&gt;Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long&lt;br /&gt;Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long&lt;br /&gt;Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long&lt;br /&gt;Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long&lt;br /&gt;Declare Function ReleaseCapture Lib "user32" () As Long&lt;br /&gt;Private Const GWL_STYLE As Long = (-16)&lt;br /&gt;Private wHandle As Long&lt;br /&gt;&lt;br /&gt;Sub ShowCalander()&lt;br /&gt;    Calander.Show&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;3. &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#CopyForm"target="_blank"&gt;Move form named calander from the downloadable file to your file&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;With these steps you can send the file to other users and it will work in similar way as it works on your machine.&lt;br /&gt;&lt;br /&gt;In addition you can &lt;a href="http://www.yogeshguptaonline.com/2009/05/macros-in-excel-forcing-users-to-enable.html"target="_blank"&gt;force users to enable macros&lt;/a&gt; while using your file&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/datepicker.xls?attredirects=0&amp;d=1"&gt;Download file with Excel Date Picker Utility&lt;/a&gt;&lt;/H3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5378915991186336663?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5378915991186336663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/excel-macros-excel-date-picker.html#comment-form' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5378915991186336663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5378915991186336663'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2010/01/excel-macros-excel-date-picker.html' title='Excel Macros : Excel Date Picker'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3QrPv-CwOcc/Sz2Mybp42UI/AAAAAAAAAMY/2sMXvdXc_7I/s72-c/Date+Picker.png' height='72' width='72'/><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-595254743607698695</id><published>2009-12-05T09:59:00.001+05:30</published><updated>2010-03-05T16:54:59.671+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Get Number From String'/><category scheme='http://www.blogger.com/atom/ns#' term='Extract Number From String'/><category scheme='http://www.blogger.com/atom/ns#' term='Extract Number From Text'/><category scheme='http://www.blogger.com/atom/ns#' term='Custom Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Text To Numbers'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macros : Text to Numbers VBA</title><content type='html'>Some times you get data which has some numbers surrounded by lots of text or non text characters or space in between text and numbers. Position of the numbers within text is not same in each data line. In such situation you may not be able to apply standard Excel Formulas to extract number from text. In such scenario you will need to use VBA to Extract Number from String. Today I am sharing with you UDF to perform this function. Just for illustration following table will show you capability of this UDF.&lt;br /&gt;&lt;table ALIGN=CENTERcellspacing="0" cellpadding="0" width="80%" border="0"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Text Data&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;Extracted Numeric Value&lt;/Div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;xusdhd 10005000&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10005000&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;AKSID0100050000 A1&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;100050000&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;IU EW KFID100050000 A 1&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;100050000&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;10005 0000 A1&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;100050000&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;01000 A1 B 12&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1000&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Above Numeric Values have been extracted using simple formula =Number(B3) , In this case text string is in Cell B3. This formula is not available in standard excel functions. To apply this formula You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;'****************************************************************&lt;br /&gt;'* User Defined Function (UDF) to Get Numeric Value from String *&lt;br /&gt;'****************************************************************&lt;br /&gt;Function Number(ByVal CurrString As String)&lt;br /&gt;    Dim temp As String&lt;br /&gt;    &lt;br /&gt;    temp = Left(CurrString, 1)&lt;br /&gt;    Do While Not IsNumeric(temp)&lt;br /&gt;        If Len(CurrString) &lt;= 1 Then&lt;br /&gt;            Exit Function&lt;br /&gt;        Else&lt;br /&gt;            CurrString = Mid(CurrString, 2)&lt;br /&gt;            temp = Left(CurrString, 1)&lt;br /&gt;        End If&lt;br /&gt;    Loop&lt;br /&gt;    Number = Val(CurrString)&lt;br /&gt;End Function&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/ExtractNumberfromString.xls?attredirects=0&amp;d=1"&gt;&lt;H3&gt;Download excel file with UDF for Text to Numbers&lt;/H3&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-595254743607698695?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/595254743607698695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/12/excel-macros-text-to-numbers-vba.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/595254743607698695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/595254743607698695'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/12/excel-macros-text-to-numbers-vba.html' title='Excel Macros : Text to Numbers VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7580232784723396100</id><published>2009-11-22T14:37:00.000+05:30</published><updated>2009-11-22T14:39:05.589+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Vlookup Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><title type='text'>Excel Formula : Using Vlookup Function</title><content type='html'>One Golden Rule while working with Excel Formula's is never enter a hard coded value into Formula. If you can calculate a value with a formula, it should not be hard coded into your formula's&lt;br /&gt;&lt;br /&gt;Today we will talk about how this is relevant in using Vlookup Function. We all use Vlookup function in our day to day working with the data in Excel. Given below is the Syntex for Vlookup function just for reference purpose.&lt;br /&gt;&lt;br /&gt;VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/Swj38xQxnVI/AAAAAAAAAMI/_m7MvRNmcMo/s1600/TableforVlookupFunction.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5406843976046189906" style=" MARGIN: 0px 10px 10px 0px; WIDTH: 400px; CURSOR: hand; HEIGHT: 295px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/Swj38xQxnVI/AAAAAAAAAMI/_m7MvRNmcMo/s400/TableforVlookupFunction.jpg" border="0" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;Picture on the above is typical data table used by us. Column C to N are hidden in this just to keep the table visible on screen. We need to get the sales value using vlookup formula. Most of the users (including me till some time back) hardcode col_index_num. Most common use of Vlookup Function for getting data from the table like above will be a formula like this. &lt;br /&gt;=VLOOKUP(B13,B3:P10,15,0)&lt;br /&gt;&lt;br /&gt;Here lookup_value is given at Cell B13, table_array is a Range B3:P10, col_index_num is 15 as it is 15th Column starting from Column B, range_lookup is 0 as we are looking for exact match.&lt;br /&gt;&lt;br /&gt;In above formula the col_index_num is hard coded. Formula will give correct results till you do not insert or delete columns in between. Once you have done so , all your formulas will not update sales figure but reference some other value.&lt;br /&gt;&lt;br /&gt;However with the following formula you can overcome this issue. You can calculate the number of columns with the help of Columns function of Excel.&lt;br /&gt;=VLOOKUP(B13,$B$3:$P$10,COLUMNS(B3:P3),0)&lt;br /&gt;&lt;br /&gt;COLUMNS(B3:P3) will be calculated as 15 and in case you insert any column between table_array your formula will change to VLOOKUP(B13,$B$3:$Q$10,COLUMNS(B3:Q3),0). Now columns function withing your formula will be calculated as 16 giving you correct value. This makes your Vlookup function dynamic.&lt;br /&gt;&lt;br /&gt;Do refer to my earlier tip on &lt;a href="http://http//www.yogeshguptaonline.com/2008/12/defining-dynamic-ranges-range-names.html"&gt;Dynamic Range Names &lt;/a&gt;to make table_array also dynamic.&lt;br /&gt;&lt;br /&gt;You are welcome to share your way of entering Vlookup function by way of comments to this post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7580232784723396100?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7580232784723396100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-formula-using-vlookup-function.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7580232784723396100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7580232784723396100'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-formula-using-vlookup-function.html' title='Excel Formula : Using Vlookup Function'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/Swj38xQxnVI/AAAAAAAAAMI/_m7MvRNmcMo/s72-c/TableforVlookupFunction.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-991389705082221801</id><published>2009-11-18T17:05:00.003+05:30</published><updated>2010-03-05T16:53:56.059+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Email Address Extract'/><title type='text'>Excel Macro : Email Address Extract from String</title><content type='html'>Last week I got a mail from my friend asking for help in extracting email IDs from data available with him. The position of the mail IDs within the text string was not same and he was finding it difficult to us extract email addresses. &lt;br /&gt;&lt;br /&gt;I wrote a quick UDF for him which did the job. I am sharing same with you as you may find it use full. &lt;br /&gt;&lt;br /&gt;Sample of the data and mail IDs extracted with the UDF is as below&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SwPM1rttdEI/AAAAAAAAAMA/rJtkcx1l43U/s1600/GetmailID.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 117px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SwPM1rttdEI/AAAAAAAAAMA/rJtkcx1l43U/s400/GetmailID.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5405389200414307394" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is the VBA code to Email Address Extract from String. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 300px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Function Getmailid(cell As Range) As String&lt;br /&gt;&lt;br /&gt;Dim Textstrng As String&lt;br /&gt;&lt;br /&gt;Textstrng = cell.Text&lt;br /&gt;Position@ = InStr(1, Textstrng, "@")&lt;br /&gt;EmStart = InStrRev(Textstrng, " ", Position@)&lt;br /&gt;If EmStart = 0 Then EmStart = 1&lt;br /&gt;EmEnd = InStr(Position@, Textstrng, " ")&lt;br /&gt;If EmEnd = 0 Then EmEnd = Len(Textstrng) + 1&lt;br /&gt;&lt;br /&gt;mailid = Trim(Mid(Textstrng, EmStart, EmEnd - EmStart))&lt;br /&gt;&lt;br /&gt;If Right(mailid, 1) = "." Then&lt;br /&gt;Getmailid = Left(mailid, Len(mailid) - 1)&lt;br /&gt;Else&lt;br /&gt;Getmailid = mailid&lt;br /&gt;End If&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/EmailAddressExtractfromstring.xls?attredirects=0&amp;d=1"&gt;&lt;H3&gt;Download file with VBA code to Email Address Extract from Text String&lt;/H3&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-991389705082221801?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/991389705082221801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-macro-email-address-extract-from.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/991389705082221801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/991389705082221801'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-macro-email-address-extract-from.html' title='Excel Macro : Email Address Extract from String'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3QrPv-CwOcc/SwPM1rttdEI/AAAAAAAAAMA/rJtkcx1l43U/s72-c/GetmailID.jpg' height='72' width='72'/><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6511851382483438605</id><published>2009-11-13T20:08:00.002+05:30</published><updated>2010-03-05T16:52:13.432+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hide cell contents before printing'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Adding non printing information to your worksheet'/><title type='text'>Excel Macro : Hide Cell Content from Printing</title><content type='html'>Some times we have some information in worksheet which is we need to input but do not want that information to be printed. With the following macro code you can achieve the desired results&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Workbook" target="_blank"&gt; copy this code to workbook module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 250px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Private Sub Workbook_BeforePrint(Cancel As Boolean)&lt;br /&gt;    Application.EnableEvents = False&lt;br /&gt;    Cancel = True&lt;br /&gt;    A = Range("A1").NumberFormat&lt;br /&gt;    Range("A1").NumberFormat = ";;;"&lt;br /&gt;    &lt;br /&gt;    Application.Dialogs(xlDialogPrint).Show&lt;br /&gt;     &lt;br /&gt;    Range("A1").NumberFormat = A&lt;br /&gt;    Application.EnableEvents = True&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;As per above code the contents of Range A1 will not be printed, you will need to change this reference to your cell.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/HideCellInformationwhileprinting.xls?attredirects=0"&gt;&lt;H3&gt;Download file with the code to hide cell contents before printing&lt;/H3&gt;&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6511851382483438605?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6511851382483438605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-macro-hide-cell-content-from.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6511851382483438605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6511851382483438605'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-macro-hide-cell-content-from.html' title='Excel Macro : Hide Cell Content from Printing'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-4500756832523407095</id><published>2009-11-06T17:10:00.003+05:30</published><updated>2009-11-06T17:16:22.240+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sumif multiple criteria'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><category scheme='http://www.blogger.com/atom/ns#' term='sumif multiple'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple sumif criteria'/><title type='text'>Excel Formula : Sumif Multiple Criteria</title><content type='html'>This is in continuation of my earlier post on &lt;a href="http://www.yogeshguptaonline.com/2009/10/excel-formulas-countif-multiple.html"target="_blank"&gt;Countif Multiple Criteria&lt;/a&gt; The same logic can be extended to calculate sum based on multiple criteria. &lt;br /&gt;&lt;br /&gt;In case you have Excel 2007, you can use built in function Sumifs . This will let you add multiple conditions. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SvPEcV4ypaI/AAAAAAAAALg/1sJBBQJNW80/s1600-h/sumif+Multiple+Criteria+-+Table.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 290px; height: 320px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SvPEcV4ypaI/AAAAAAAAALg/1sJBBQJNW80/s320/sumif+Multiple+Criteria+-+Table.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5400876369338082722" /&gt;&lt;/a&gt;&lt;br /&gt;In case of Excel 2003 or earlier version using Pivot table will get you the results easily but if You don't have liberty to use Pivot, then you will need formula trick. Consider that you have a data table like this and you need to know what is sales in "North" region by sales man "Ram". &lt;br /&gt;&lt;br /&gt;Following sumproduct formula will do the calculation for you. &lt;br /&gt;&lt;br /&gt;=SUMPRODUCT(($B$13:$B$28="North")*($C$13:$C$28="Ram")*($E$13:$E$28))&lt;br /&gt;&lt;br /&gt;Another way is to write an array formula. &lt;br /&gt;=SUM(($B$13:$B$28="North")*($C$13:$C$28="Ram")*($E$13:$E$28))&lt;br /&gt;However this will need to be confirmed with CTRL+Shift+Enter (CSE)&lt;br /&gt;&lt;br /&gt;After CSE formula will show {} in formula bar. This will covert it to an array formula. The formula will look like following picture after CSE in formula bar&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SvPGts8Gi1I/AAAAAAAAALo/ylQK0p_YKks/s1600-h/Sumif+Multiple+Criteria+-+Array+Formula.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 320px; height: 15px;" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SvPGts8Gi1I/AAAAAAAAALo/ylQK0p_YKks/s320/Sumif+Multiple+Criteria+-+Array+Formula.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5400878866607016786" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I suggest you to use Sumproduct formula as you may find it difficult to enter array formula.&lt;br /&gt;&lt;br /&gt;If you see the dialog for sumproduct formula entry you will understand the reasons behind this recommendation. Actually sumproduct is a workaround to enter array formula. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SvPJXKgLoZI/AAAAAAAAALw/FYoHdZhfJyQ/s1600-h/Sumproduct+Array.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 109px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SvPJXKgLoZI/AAAAAAAAALw/FYoHdZhfJyQ/s400/Sumproduct+Array.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5400881777940865426" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you see above dialog screen , you will notice &lt;br /&gt;&lt;br /&gt;1. When you enter ranges, you are actually entering array's.&lt;br /&gt;2. This formula is entered in single array only to get the results.&lt;br /&gt;&lt;br /&gt;If you try to use sumproduct as normal formula to calculate sum based on multiple conditions , you will not get the results.&lt;br /&gt;&lt;br /&gt;Actually multiple condistional sum can be calculated using arrays only and sumproduct allows you to enter array's easily and you can over come the difficulty of entering array formula.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://in.yogeshguptaonline.com/resources/excel-formulas/SumifMutlipleCondition.xls?attredirects=0"target="_blank"&gt;&lt;H3&gt;Download Excel File having Sumif Multiple Criteria Formulas&lt;/H3&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-4500756832523407095?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/4500756832523407095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-formula-sumif-multiple-criteria.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4500756832523407095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4500756832523407095'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/11/excel-formula-sumif-multiple-criteria.html' title='Excel Formula : Sumif Multiple Criteria'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3QrPv-CwOcc/SvPEcV4ypaI/AAAAAAAAALg/1sJBBQJNW80/s72-c/sumif+Multiple+Criteria+-+Table.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1528776040457600695</id><published>2009-10-30T17:29:00.003+05:30</published><updated>2010-02-08T21:12:13.991+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Formating Numbers in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Indian Style Comma Separation for numbers'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Number Format : Indian Style Comma Separation</title><content type='html'>Yesterday I got a comment asking for custom number format for Indian style comma separation. While I responded to question by providing the custom number format I knew that the answer does not handle the complete range of numbers and can not be applied in all the cases. This forced me to look around for a solution that can be applied for all kind of numbers. &lt;br /&gt;&lt;br /&gt;Just for the information of people who are not aware of Indian Style of comma separation, I have produced table below which explains Indian style formatting for various numbers. The basic rule is that first comma separation happens at 3 digits i.e. 1000 then it happens after every 2 digits. Check out table below for better understanding.&lt;br /&gt;&lt;TABLE width="80%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;Number&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;Formatted As&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;10&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;100&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;100.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;1000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;10000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;100000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;1000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;10000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1,00,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;100000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10,00,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;1000000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1,00,00,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;10000000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;10,00,00,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;div align="right"&gt;100000000000&lt;/DIV&gt;&lt;/td&gt;&lt;td&gt;&lt;div align="right"&gt;1,00,00,00,00,000.00&lt;/DIV&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;br /&gt;Soon I realised that there is no single custom format available for handling all kind of number length and we need separate format for it depending upon the number of digits. Doing this manually and accuratly every time is very difficult. This leaves only one option to automate this through a macro. I got a Macro code for doing this and modified and tested that for long numbers. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2009/10/excel-number-format-indian-style-comma.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/IndianStyleCommaSeparation.gif" border="0" alt="IndiaStyleCommaSeparation"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I am sharing the macro code with you. You will need to select the numbers and run macro to format them as per India style comma sepration.&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Sub IndianNumberFormat()&lt;br /&gt;For Each c In Selection&lt;br /&gt;Select Case Abs(c.Value)&lt;br /&gt;Case Is &lt; 100000&lt;br /&gt;c.Cells.NumberFormat = "##,##0.00"&lt;br /&gt;Case Is &lt; 10000000&lt;br /&gt;c.Cells.NumberFormat = "#\,##\,##0.00"&lt;br /&gt;Case Is &lt; 1000000000&lt;br /&gt;c.Cells.NumberFormat = "#\,##\,##\,##0.00"&lt;br /&gt;Case Is &lt; 1000000000&lt;br /&gt;c.Cells.NumberFormat = "#\,##\,##\,##0.00"&lt;br /&gt;Case Is &lt; 100000000000#&lt;br /&gt;c.Cells.NumberFormat = "#\,##\,##\,##\,##0.00"&lt;br /&gt;Case Else&lt;br /&gt;c.Cells.NumberFormat = "#\,##\,##\,##\,##\,##0.00"&lt;br /&gt;End Select&lt;br /&gt;Next c&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;For easy application of this code you need to save it as a excel addin or add it to your personal macro book. Adding a custom toolbar for this code will make it easy to apply. You can chage the number of decimal places by changing the number of zeros at the end of custom number format given above.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1528776040457600695?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1528776040457600695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-number-format-indian-style-comma.html#comment-form' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1528776040457600695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1528776040457600695'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-number-format-indian-style-comma.html' title='Excel Number Format : Indian Style Comma Separation'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5622459923055233398</id><published>2009-10-27T21:37:00.003+05:30</published><updated>2009-10-27T21:52:09.788+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Number Format'/><category scheme='http://www.blogger.com/atom/ns#' term='Formating Numbers in Excel'/><title type='text'>Excel Number Format : Telephone numbers with leading + sign</title><content type='html'>This is in continuation of my earlier post &lt;a href="http://www.yogeshguptaonline.com/2009/04/custom-formating-excel-number-format.html" target="_blank"&gt;Custom Formating - Excel Number Format&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Excel does not display the leading + sign entered by users, similarly the leading zeros are also not recoganised by excel. However custom formating trick can help you do this. Refer to the following table, where in Phone number 9971112814 has been formated differently to display different formats for the same cell contents.&lt;br /&gt;&lt;br /&gt;91 is country code for India, you can change it to whatever code you want to display the number accordingly. &lt;br /&gt;&lt;br /&gt;&lt;TABLE width="100%" border="0" cellspacing="0" cellpadding="0"&gt;&lt;tr&gt;&lt;td&gt;Format&lt;/td&gt;&lt;td&gt;Displayed as&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+91 0000000000&lt;/td&gt;&lt;td&gt;+91 9971112814&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+91(0)0000000000&lt;/td&gt;&lt;td&gt;+91(0)9971112814&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;+91(0)000-000-0000&lt;/td&gt;&lt;td&gt;+91(0)997-111-2814&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;0091 0000000000&lt;/td&gt;&lt;td&gt;0091 9971112814&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/TABLE&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5622459923055233398?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5622459923055233398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-number-format-telephone-numbers.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5622459923055233398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5622459923055233398'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-number-format-telephone-numbers.html' title='Excel Number Format : Telephone numbers with leading + sign'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6770447092880995768</id><published>2009-10-23T18:57:00.013+05:30</published><updated>2010-02-05T14:25:55.815+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='multiple countif'/><category scheme='http://www.blogger.com/atom/ns#' term='countif with multiple criteria'/><category scheme='http://www.blogger.com/atom/ns#' term='countif multiple conditions'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><category scheme='http://www.blogger.com/atom/ns#' term='Countif Multiple Criteria'/><category scheme='http://www.blogger.com/atom/ns#' term='countif two criteria'/><category scheme='http://www.blogger.com/atom/ns#' term='countif array'/><title type='text'>Excel Formulas : Countif Multiple Criteria</title><content type='html'>Many times we need to perform a count based on multiple criteria.&lt;br /&gt;&lt;br /&gt;This is very simple if you are using Excel 2007. You have standard excel function Countifs which lets you do the count based on multiple criteria. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SuGvxx8umKI/AAAAAAAAAKk/5sYLx6CKN2I/s1600-h/Countif+Multiple+Criteria+-+Table.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 312px; height: 400px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SuGvxx8umKI/AAAAAAAAAKk/5sYLx6CKN2I/s400/Countif+Multiple+Criteria+-+Table.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5395787098323064994" /&gt;&lt;/a&gt;&lt;br /&gt;But if you are using Excel 2003 this becomes tricky as you do not have any standard function that lets you do this. However you can do it using Pivot Tables. Sometimes you just need the count based on multiple criteria to be put into a report and using Pivot tables for such report may not be a viable option. &lt;br /&gt;&lt;br /&gt;In such scenarios you need to go for a workaround using excel formula. Considering you have a data table like this and you want to know the number of customers in North Area serviced by Sales Man by name of Ram.&lt;br /&gt;&lt;br /&gt;If you have Excel 2007 then it very simple just use &lt;br /&gt;=COUNTIFS($B$13:$B$28,"North",$C$13:$C$28,"Ram") and it will give you count result 3.&lt;br /&gt;&lt;br /&gt;For Excel 2003 users My favorite for such kind of calculation is Sumproduct function and you can do it with the help of following formula. &lt;br /&gt;=SUMPRODUCT(($B$13:$B$28="North")*($C$13:$C$28="Ram"))&lt;br /&gt;This formula will give you result as 3 customers. &lt;br /&gt;You can add as many conditions here but be sure that the height of the range is same for all ranges mentioned in this formula&lt;br /&gt;&lt;br /&gt;This actually is a workaround for another method array formula.&lt;br /&gt;=SUM(($B$13:$B$28="North")*($C$13:$C$28="Ram")) confirmed with CTRL+Shift+Enter&lt;br /&gt;Once you confirm this formula with CTRL+Shift+Enter it will add {} to the formula which will be visible in the formula bar only. &lt;br /&gt;&lt;br /&gt;Look at the screen cast below to know the difference it make to the normal formula once confirmed as CSE formula. Look for the addtional {} added to formula&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2009/10/excel-formulas-countif-multiple.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/CountifMultipleArrayformula.gif" border="0" alt="www.yogeshguptaonline.com"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H3&gt;&lt;a href="http://in.yogeshguptaonline.com/resources/excel-formulas/CountifMutlipleCondition.xls?attredirects=0&amp;d=1"target="_blank"&gt;Download file having countif multiple conditions formula&lt;/a&gt;&lt;/H3&gt;&lt;br /&gt;&lt;br /&gt;You may find it difficult to enter array formula that is why I suggest you to go for SUMPRODUCT method. &lt;br /&gt;To know more about array formulas you can read &lt;b&gt;&lt;H3&gt;&lt;a href="http://office.microsoft.com/en-us/excel/HA010872901033.aspx" target="_blank"&gt;Introducing array formulas in Excel&lt;/a&gt;&lt;/H3&gt;&lt;/B&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6770447092880995768?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6770447092880995768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-formulas-countif-multiple.html#comment-form' title='43 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6770447092880995768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6770447092880995768'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-formulas-countif-multiple.html' title='Excel Formulas : Countif Multiple Criteria'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3QrPv-CwOcc/SuGvxx8umKI/AAAAAAAAAKk/5sYLx6CKN2I/s72-c/Countif+Multiple+Criteria+-+Table.jpg' height='72' width='72'/><thr:total>43</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1857037728110245134</id><published>2009-10-18T07:18:00.004+05:30</published><updated>2009-10-18T08:20:24.618+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Excel Dates : Leap Year or Not a Leap Year</title><content type='html'>Excel follows Gregorian calendar which was first established in 1582 by Pope Gregory XIII.&lt;br /&gt;&lt;H3&gt;To determine whether a year is a leap year, follow these steps: &lt;/H3&gt;&lt;br /&gt;&lt;Pre&gt;&lt;br /&gt;  1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. &lt;br /&gt;  2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. &lt;br /&gt;  3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. &lt;br /&gt;  4. The year is a leap year (it has 366 days). &lt;br /&gt;  5. The year is not a leap year (it has 365 days). &lt;br /&gt;&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;Following formula gives the results based on above steps. This considers that you have stored year in Cell A1 of your worksheet&lt;br /&gt;&lt;br /&gt;=IF(OR(MOD(A1,400)=0,AND(MOD(A1,4)=0,MOD(A1,100)&lt;&gt;0)),"Leap Year", "NOT a Leap Year")&lt;br /&gt;&lt;br /&gt;Since excel has all these calculations built in , you can just test the &lt;a href="http://www.yogeshguptaonline.com/2009/01/entering-last-day-of-month-in-excel.html"&gt;last day of the February month&lt;/a&gt; and decide based on day value. If it is 29 then Leap Year else NOT a Leap Year. &lt;br /&gt;&lt;br /&gt;Following formula gives the results based on above steps. This considers that you have stored year in Cell A1 of your worksheet&lt;br /&gt;&lt;br /&gt;=IF(DAY(DATE(A1,3,0))=29,"Leap Year","NOT a Leap Year")&lt;br /&gt;&lt;br /&gt;First Formula returns 1900 as "NOT a Leap Year" but second Formula will return it as "Leap Year". This is due to bug in excel which considers 1900 as a Leap Year though it was not a leap year. &lt;br /&gt;&lt;br /&gt;This is why I will recommend to use second Formula in excel to determine a Leap Year since it takes care of any bug that exists in excel&lt;br /&gt;&lt;br /&gt;&lt;H3&gt;VBA Function for Leap Year Test:&lt;/H3&gt;&lt;Pre&gt;&lt;br /&gt;Public Function IsLeapYear(ByVal YY As Long) As Boolean&lt;br /&gt;    IsLeapYear = Day(DateSerial(YY, 3, 0)) = 29&lt;br /&gt;End Function&lt;br /&gt;&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H2&gt;Leap Year , leap year test , leap year check , check leap year , Leap Year in Excel &lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1857037728110245134?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1857037728110245134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-dates-leap-year-or-not-leap-year.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1857037728110245134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1857037728110245134'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-dates-leap-year-or-not-leap-year.html' title='Excel Dates : Leap Year or Not a Leap Year'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-4249646606102417268</id><published>2009-10-12T15:57:00.006+05:30</published><updated>2010-01-15T14:52:29.831+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Converting Text to date'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Excel Convert Text to Date</title><content type='html'>Many of us get into a situation when the dates in our data are coded as text. Excel does not recognise such text entries as date and we can not use them for any calculation purpose. However you can easily covert them to date by the help of excel formula. &lt;br /&gt;&lt;br /&gt;You may have a situation where the text of the date is actually as date but being a text string it is not recognised as date by excel. It could be 12/Oct/2009 in text string. You can easily convert them using Datevalue formula. Assuming you have text in cell A2, the formula you need to enter is =DATEVALUE(A2)&lt;br /&gt;&lt;br /&gt;However many time we get data stored like 20091012. Here October 12, 2009 has been stored as First 4 digits as Year, next 2 Digits as Month, next 2 Digits as Day. It becomes little tricky but it can also be converted to date using combination of Mid and Date function of excel. &lt;br /&gt;&lt;br /&gt;Assuming you have date stored as 20091012 in cell A3 of you worksheet, you can convert it to date using =DATE(MID(A3,1,4),MID(A3,5,2),MID(A3,7,2))&lt;br /&gt;&lt;br /&gt;Logic behind this formula is devide the text into Year , Month and Day separatly. This is done by using MID function of excel. Once you are able to break text string into three different components of Date. You put these in the Date Function of Excel. Syntex for Excel Date function is DATE(year, month, day). &lt;br /&gt;&lt;br /&gt;MID(A3,1,4) = 2009 - This Year Value in Text String&lt;br /&gt;MID(A3,5,2) = 10   - This is Month Value in Text String&lt;br /&gt;MID(A3,7,2) = 12   - This is Day Value in Text String&lt;br /&gt;&lt;br /&gt;This is converted into Grand Formula = DATE(MID(A3,1,4),MID(A3,5,2),MID(A3,7,2))&lt;br /&gt;&lt;br /&gt;If you see the formula I have just brokenup the text string using MID in combination with Date function.&lt;br /&gt;&lt;br /&gt;See picture below to understand it better.&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/StMHonObf1I/AAAAAAAAAJA/A__W6Db0iC8/s1600-h/Convert+Text+to+date+in+excel.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 82px;" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/StMHonObf1I/AAAAAAAAAJA/A__W6Db0iC8/s320/Convert+Text+to+date+in+excel.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5391661573198282578" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;H2&gt; convert text to date in excel , excel convert text to date, convert text to date, date values &lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-4249646606102417268?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/4249646606102417268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-convert-text-to-date.html#comment-form' title='82 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4249646606102417268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4249646606102417268'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/10/excel-convert-text-to-date.html' title='Excel Convert Text to Date'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/StMHonObf1I/AAAAAAAAAJA/A__W6Db0iC8/s72-c/Convert+Text+to+date+in+excel.jpg' height='72' width='72'/><thr:total>82</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3328287920792023938</id><published>2009-09-27T12:55:00.012+05:30</published><updated>2010-03-05T16:48:31.605+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Logging User Activity'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macros : Log User Activity to Log Sheet</title><content type='html'>We all store Excel workbooks on shared drives. While those files are accessed by many users but there is no track about who did what at various points of time. However this problem can be resolved with the help of VBA. A VBA programme with following capability can help us to get the log of user activity.&lt;br /&gt;&lt;Pre&gt; &lt;br /&gt;     1. Add sheet named Log in case it is does not exist in the file.&lt;br /&gt;     2. Record user activity based on events to Log sheet.&lt;br /&gt;     3. Along with recording a event, it records user information and time of event.&lt;br /&gt;     4. Manage log size and removes old entries while creating space for new entries.&lt;br /&gt;     5. User can view the log but can not make changes to the log.&lt;br /&gt;&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;Following code has all these capabilities. Macro given below records user activity based on event information passed to it by another macro. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Sub Elog(Evnt As String)&lt;br /&gt;    &lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    '* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 27, 2009 *&lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    &lt;br /&gt;    Application.ScreenUpdating = False&lt;br /&gt;    Dim cRecord As Long&lt;br /&gt;    cSheet = ActiveSheet.Name&lt;br /&gt;    &lt;br /&gt;    If SheetExists("Log") = False Then&lt;br /&gt;        Sheets.Add.Name = "Log"&lt;br /&gt;        Sheets("Log").Select&lt;br /&gt;        ActiveSheet.Protect "Pswd", UserInterfaceOnly:=True&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;        Sheets("Log").Visible = True&lt;br /&gt;        Sheets("Log").Select&lt;br /&gt;        ActiveSheet.Protect "Pswd", UserInterfaceOnly:=True&lt;br /&gt;        &lt;br /&gt;        cRecord = Range("A1")&lt;br /&gt;    If cRecord &lt;= 2 Then&lt;br /&gt;        cRecord = 3&lt;br /&gt;        Range("A2").Value = "Event"&lt;br /&gt;        Range("B2").Value = "User Name"&lt;br /&gt;        Range("C2").Value = "Domain"&lt;br /&gt;        Range("D2").Value = "Computer"&lt;br /&gt;        Range("E2").Value = "Date and Time"&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;    If Len(Evnt) &lt; 25 Then Evnt = Application.Rept(" ", 25 - Len(Evnt)) &amp; Evnt&lt;br /&gt;    &lt;br /&gt;    Range("A" &amp; cRecord).Value = Evnt&lt;br /&gt;    Range("B" &amp; cRecord).Value = Environ("UserName")&lt;br /&gt;    Range("C" &amp; cRecord).Value = Environ("USERDOMAIN")&lt;br /&gt;    Range("D" &amp; cRecord).Value = Environ("COMPUTERNAME")&lt;br /&gt;    Range("E" &amp; cRecord).Value = Now()&lt;br /&gt;    cRecord = cRecord + 1&lt;br /&gt;    &lt;br /&gt;    If cRecord &gt; 20002 Then&lt;br /&gt;        Range("A3:A5002").Select&lt;br /&gt;        dRows = Selection.Rows.Count&lt;br /&gt;        Selection.EntireRow.Delete&lt;br /&gt;        cRecord = cRecord - dRows&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;    Range("A1") = cRecord&lt;br /&gt;    Columns.AutoFit&lt;br /&gt;    Sheets(cSheet).Select&lt;br /&gt;    Sheets("Log").Visible = xlVeryHidden&lt;br /&gt;    Application.ScreenUpdating = True&lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;Function SheetExists(SheetName As String) As Boolean&lt;br /&gt;    On Error GoTo SheetDoesnotExit&lt;br /&gt;    If Len(Sheets(SheetName).Name) &gt; 0 Then&lt;br /&gt;        SheetExists = True&lt;br /&gt;        Exit Function&lt;br /&gt;    End If&lt;br /&gt;SheetDoesnotExit:&lt;br /&gt;        SheetExists = False&lt;br /&gt;End Function&lt;br /&gt;Sub ViewLog()&lt;br /&gt;    Sheets("Log").Visible = True&lt;br /&gt;    Sheets("Log").Select&lt;br /&gt;End Sub&lt;br /&gt;Sub HideLog()&lt;br /&gt;    Sheets("Log").Visible = xlVeryHidden&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Following macros record events like &lt;H2&gt;"Open" , "Save" and "Print"&lt;/H2&gt; and pass on the information to above macro to record user activity.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkSheet" target="_blank"&gt; copy this code to worksheet module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Private Sub Workbook_BeforePrint(Cancel As Boolean)&lt;br /&gt;Dim Evnt As String&lt;br /&gt;Evnt = "Print"&lt;br /&gt;Call Elog(Evnt)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)&lt;br /&gt;Dim Evnt As String&lt;br /&gt;Evnt = "Save"&lt;br /&gt;Call Elog(Evnt)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;Dim Evnt As String&lt;br /&gt;Evnt = "Open"&lt;br /&gt;Call Elog(Evnt)&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Since this code will record user activity only in case macros are enabled, do not forget to &lt;a href="http://www.yogeshguptaonline.com/2009/05/macros-in-excel-forcing-users-to-enable.html"target="_blank"&gt; force users to enable macros while useing the particular file&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/UserLogtologsheet.xls?attredirects=0"&gt;&lt;H3&gt;Download file having these macros to record user activity to a log sheet. Check how it works&lt;/H3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;H2&gt; record user activity , track user activity, logging user activity, log user activity , monitor user activity &lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3328287920792023938?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3328287920792023938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-log-user-activity-to-log.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3328287920792023938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3328287920792023938'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-log-user-activity-to-log.html' title='Excel Macros : Log User Activity to Log Sheet'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7030723959713765421</id><published>2009-09-22T21:16:00.006+05:30</published><updated>2010-03-05T16:45:37.675+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Symbol Check Mark'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Wingdings Check Mark with double click'/><title type='text'>Excel Macros : Check Mark Symbols with Double Click</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/Srj1gS0EbjI/AAAAAAAAAHs/9FTEXST7FEQ/s1600-h/Check+Mark+Symbol.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 74px; height: 320px;" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/Srj1gS0EbjI/AAAAAAAAAHs/9FTEXST7FEQ/s320/Check+Mark+Symbol.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5384323289676279346" /&gt;&lt;/a&gt;&lt;br /&gt;I am sharing with you very interesting trick to insert check mark symbols / to change check mark symbols with the double click in excel.&lt;br /&gt;&lt;br /&gt;We can use Wingding font check boxes and change them with the double click with the help of macro&lt;br /&gt;&lt;br /&gt;You can add as many of them by just defining the range in your macro. Values can be changed by just a double click.&lt;br /&gt;&lt;br /&gt;You will further need to do data validation for that range so that user does not enter any other value by mistake.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkSheet" target="_blank"&gt; copy this code to worksheet module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt; &lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;&lt;br /&gt;Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)&lt;br /&gt;&lt;br /&gt;'*************************************************************************************************************************&lt;br /&gt;'* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 16, 2009                      *&lt;br /&gt;'*************************************************************************************************************************&lt;br /&gt;    &lt;br /&gt;    If Not Intersect(Target, Range("G4:G14")) Is Nothing Then ' You can Change the range here&lt;br /&gt;        &lt;br /&gt;        Cancel = True&lt;br /&gt;        &lt;br /&gt;        With Target&lt;br /&gt;            .Font.Name = "Wingdings"&lt;br /&gt;            .Font.Size = 20&lt;br /&gt;            .HorizontalAlignment = xlCenter&lt;br /&gt;        End With&lt;br /&gt;      &lt;br /&gt;        If Target.Value = "þ" Then&lt;br /&gt;            Target.Value = "ý"&lt;br /&gt;            &lt;br /&gt;        Else&lt;br /&gt;            Target.Value = "þ"&lt;br /&gt;        End If&lt;br /&gt;    &lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/ChangeValuebydoubleclick.xls?attredirects=0"&gt;&lt;H3&gt;Download file having trick to insert /change wingdings check mark symbols with double click&lt;/H3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Make sure that you have enabled macros before using this file.&lt;br /&gt;&lt;br /&gt;This trick can be used to choose any values you want change with the double click and is not limited only to check boxes in wingdings. See the attached file for Yes/No as another example.&lt;br /&gt;&lt;br /&gt;&lt;H2&gt; Symbol Check Mark , Symbols Check Mark , Type Check Mark , Wingding Font Check Mark , Wingding Check Mark , Wingdings Check Mark , Check Mark Symbol , Check Mark Symbols , Check Symbol , Change values with double click in excel &lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7030723959713765421?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7030723959713765421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-check-mark-symbols-with.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7030723959713765421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7030723959713765421'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-check-mark-symbols-with.html' title='Excel Macros : Check Mark Symbols with Double Click'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_3QrPv-CwOcc/Srj1gS0EbjI/AAAAAAAAAHs/9FTEXST7FEQ/s72-c/Check+Mark+Symbol.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1890077692483755703</id><published>2009-09-16T14:50:00.007+05:30</published><updated>2010-03-05T16:43:15.309+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='File Open'/><category scheme='http://www.blogger.com/atom/ns#' term='Test if workbook is open or not'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macro : File open VBA</title><content type='html'>Before opening a excel file using VBA, you need to test particular file is open or not in excel. This is required as it can result into a error if particular file is already open.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;You need to go step by step to open the file &lt;br /&gt;    1. Check if excel file is open &lt;br /&gt;    2. Open that file using VBA , This should be done only in case you know the full path for the particular file &lt;br /&gt;    3. In case you do not know the full path , it is advisable to give excel file open dialog and let user open the file.&lt;/Pre&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;Pre&gt;Sub Open_File_after_IsOpen_or_Not()&lt;br /&gt;&lt;br /&gt;'*************************************************************************************************************&lt;br /&gt;'* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 16, 2009          *&lt;br /&gt;'* Macro modified on September 19, 2009 based on inputs from Mr. Augusto as per comment left by him          *&lt;br /&gt;'* Mr. Augusto added FileExist function though his comment and included in this Updated Macro by Yogesh Gupta*&lt;br /&gt;'*************************************************************************************************************&lt;br /&gt;&lt;br /&gt;Dim Myworkbook As String&lt;br /&gt;&lt;br /&gt;Myworkbook = "FileName.xls" ' Replace the workbook name here&lt;br /&gt;&lt;br /&gt;If Isopen(Myworkbook) = "Not Open" Then ' In case workbook is not open&lt;br /&gt;  &lt;br /&gt;    If FileExist(Myworkbook) = True Then ' In case workbook exist&lt;br /&gt;    &lt;br /&gt;        Workbooks.Open Filename:=ThisWorkbook.Path &amp; "\" &amp; Myworkbook&lt;br /&gt;    &lt;br /&gt;    Else&lt;br /&gt;&lt;br /&gt;        Call Open_new_file ' let user choose and open the file&lt;br /&gt;    &lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;Else&lt;br /&gt;    &lt;br /&gt;    Application.Workbooks(Myworkbook).Activate&lt;br /&gt;&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Open_new_file()&lt;br /&gt;&lt;br /&gt;    NewWorkbook = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls), *.xls", Title:="Please select a file")&lt;br /&gt;    If NewWorkbook = False Then&lt;br /&gt;        Exit Sub&lt;br /&gt;    Else&lt;br /&gt;        Workbooks.Open Filename:=NewWorkbook&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Public Function Isopen(Myworkbook As String)&lt;br /&gt;&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    Set wBook = Workbooks(Myworkbook)&lt;br /&gt;    If wBook Is Nothing Then&lt;br /&gt;        Isopen = "Not Open"&lt;br /&gt;        Exit Function&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;Public Function FileExist(Myworkbook As String) As Boolean&lt;br /&gt;&lt;br /&gt;Dim nfile&lt;br /&gt;&lt;br /&gt;On Error GoTo FileExist_err&lt;br /&gt;nfile = FreeFile&lt;br /&gt;Open Myworkbook For Input As nfile&lt;br /&gt;Close nfile&lt;br /&gt;&lt;br /&gt;FileExist = True&lt;br /&gt;&lt;br /&gt;Exit Function&lt;br /&gt;FileExist_err:&lt;br /&gt;FileExist = False&lt;br /&gt;End Function&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/FileopenMacro.xls?attredirects=0"&gt;&lt;H3&gt;Download file having File open Macro with test if particular workbook is open or not&lt;/H3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;File open VBA , VBA open files , File Open Macro , Excel File open VBA , VBA Excel Workbook Open , VBA Excel Open Workbook , VBA open Workbook , Test particular file is open or not in excel , Check if file is open - Excel &lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1890077692483755703?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1890077692483755703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macro-file-open-vba.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1890077692483755703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1890077692483755703'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macro-file-open-vba.html' title='Excel Macro : File open VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1581006164107634269</id><published>2009-09-09T21:14:00.019+05:30</published><updated>2010-03-05T16:39:21.117+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Remove Duplicate'/><category scheme='http://www.blogger.com/atom/ns#' term='Find Duplicate'/><title type='text'>Excel Macros : Remove Duplicates Excel</title><content type='html'>Excel 2007 has built in command to remove duplicates, however earlier versions of excel does not have built in command. You need to use VBA routine to do the job.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Use following code to Identify duplicate values in a column and Remove Rows having Duplicate Values&lt;/H3&gt;After identifying the duplicate values system will give you warning and ask for confirmation to delete the entire row(s) having duplicate values. You can choose No in case you do not want to delete them.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook &lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;Sub Find_RemoveDuplicates()&lt;br /&gt;&lt;br /&gt;    '****************************************************************************************************&lt;br /&gt;    '* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 9, 2009  *&lt;br /&gt;    '* Macro Modified on September 13, 2009 for not deleting empty cells within duplicate values column *&lt;br /&gt;    '****************************************************************************************************&lt;br /&gt;&lt;br /&gt;     &lt;br /&gt;    Dim cRow            As Long&lt;br /&gt;    Dim lRow            As Long&lt;br /&gt;    Dim sCell           As Range&lt;br /&gt;    Dim D               As Long&lt;br /&gt;        &lt;br /&gt;    lRow = GetLastRowWithData&lt;br /&gt;    &lt;br /&gt;    On Error Resume Next&lt;br /&gt;    Set sCell = Application.InputBox(Prompt:= _&lt;br /&gt;                "Select Starting Row of Column with Duplicate values.", _&lt;br /&gt;                    Title:="Select Column", Type:=8)&lt;br /&gt;    &lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    If sCell Is Nothing Then&lt;br /&gt;    Exit Sub&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;    sCell.Select&lt;br /&gt;    &lt;br /&gt;    If Selection.Cells.Count &gt; 1 Then&lt;br /&gt;        MsgBox ("Pls select Single Cell only")&lt;br /&gt;        Exit Sub&lt;br /&gt;    &lt;br /&gt;    Else&lt;br /&gt;    &lt;br /&gt;        dCol = ActiveCell.Column&lt;br /&gt;        sRow = ActiveCell.Row&lt;br /&gt;            &lt;br /&gt;        For cRow = lRow To sRow Step -1&lt;br /&gt;            If IsEmpty(Cells(cRow, dCol)) = False Then&lt;br /&gt;                If WorksheetFunction.CountIf(Range(sCell, Cells(cRow, dCol)), Cells(cRow, dCol).Text) &gt; 1 Then&lt;br /&gt;                    Cells(cRow, dCol).Interior.Color = 255  'This Marks the duplicate values as Red&lt;br /&gt;                    D = D + 1&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;        Next cRow&lt;br /&gt;    &lt;br /&gt;        If D = 0 Then&lt;br /&gt;    &lt;br /&gt;            MsgBox ("No Duplicate Values Found")&lt;br /&gt;    &lt;br /&gt;        Else&lt;br /&gt;    &lt;br /&gt;            caution = MsgBox(D &amp; " Duplicate entries selected and marked RED" &amp; vbCrLf &amp; _&lt;br /&gt;            "Do you want to delete them? " &amp; vbCrLf &amp; _&lt;br /&gt;            "Entire Row for the marked entries will be deleted. " &amp; vbCrLf &amp; _&lt;br /&gt;            "Do you want to Continue?", vbYesNo, "Confirmation")&lt;br /&gt;    &lt;br /&gt;            If caution = vbYes Then&lt;br /&gt;    &lt;br /&gt;                For cRow = lRow To sRow Step -1&lt;br /&gt;                    If IsEmpty(Cells(cRow, dCol)) = False Then&lt;br /&gt;                        If WorksheetFunction.CountIf(Range(sCell, Cells(cRow, dCol)), Cells(cRow, dCol).Text) &gt; 1 Then&lt;br /&gt;                            Cells(cRow, dCol).EntireRow.Delete  ' This deletes the entire row&lt;br /&gt;                        End If&lt;br /&gt;                    End If&lt;br /&gt;                Next cRow&lt;br /&gt;    &lt;br /&gt;            End If&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;'********************************************************************&lt;br /&gt;'* UDF to Get Last Row with Data on worksheet                       *&lt;br /&gt;'********************************************************************&lt;br /&gt;&lt;br /&gt;Public Function GetLastRowWithData() As Long&lt;br /&gt;&lt;br /&gt;    Dim ExcelLastCell As Object, lRow As Long, lLastDataRow As Long, l As Long&lt;br /&gt;&lt;br /&gt;    Set ExcelLastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)&lt;br /&gt;    lLastDataRow = ExcelLastCell.Row&lt;br /&gt;    lRow = ExcelLastCell.Row&lt;br /&gt;&lt;br /&gt;    Do While Application.CountA(ActiveSheet.Rows(lRow)) = 0 And lRow &lt;&gt; 1&lt;br /&gt;        lRow = lRow - 1&lt;br /&gt;    Loop&lt;br /&gt;&lt;br /&gt;    lLastDataRow = lRow&lt;br /&gt;    GetLastRowWithData = lLastDataRow&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/RemoveDuplicates.xls?attredirects=0"&gt;&lt;h3&gt;Download file having Macro to Find and Remove Duplicates in Excel. &lt;/H3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Above works well in case you are trying to clean a data table on the sheet, however if you have lots of other data also on the sheet, you should try the Find and Remove duplicates within Range&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.yogeshguptaonline.com/2009/09/excel-macros-remove-duplicates-excel.html"&gt;&lt;img src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/RemoveDuplicates-1.gif" border="0" alt="RemoveDuplicates"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook &lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;Sub Find_RemoveDuplicatesWithinRange()&lt;br /&gt;&lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    '* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 13, 2009 *&lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    &lt;br /&gt;    Dim cRow            As Long&lt;br /&gt;    Dim sRow            As Long&lt;br /&gt;    Dim lRow            As Long&lt;br /&gt;    Dim sCol            As Long&lt;br /&gt;    Dim lCol            As Long&lt;br /&gt;    Dim dColumn         As Long&lt;br /&gt;    Dim D               As Long&lt;br /&gt;    Dim sCell           As Range&lt;br /&gt;    Dim dRange          As Range&lt;br /&gt;&lt;br /&gt;        &lt;br /&gt;    On Error Resume Next&lt;br /&gt;    &lt;br /&gt;    Set dRange = Application.InputBox(Prompt:= _&lt;br /&gt;                "Select Data Range with Duplicate values.", _&lt;br /&gt;                    Default:=Selection.Address, Title:="Select Range", Type:=8)&lt;br /&gt;    &lt;br /&gt;    If dRange Is Nothing Then&lt;br /&gt;    Exit Sub&lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;    With dRange&lt;br /&gt;        sRow = Cells(.Row, .Column).Row&lt;br /&gt;        sCol = Cells(.Row, .Column).Column&lt;br /&gt;        lCol = Cells(.Row, .Column + .Columns.Count - 1).Column&lt;br /&gt;        lRow = Cells(.Row + .Rows.Count - 1, .Column + .Columns.Count - 1).Row&lt;br /&gt;    End With&lt;br /&gt;    &lt;br /&gt;    dColumn = 0&lt;br /&gt;    &lt;br /&gt;    Do While dColumn = 0&lt;br /&gt;       &lt;br /&gt;    Set sCell = Application.InputBox(Prompt:= _&lt;br /&gt;                "Select Column with Duplicate values.", _&lt;br /&gt;                    Title:="Select Column", Type:=8)&lt;br /&gt;    &lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    &lt;br /&gt;    If sCell Is Nothing Then&lt;br /&gt;    Exit Sub&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;   &lt;br /&gt;    If sCell.Columns.Count &gt; 1 Then&lt;br /&gt;        &lt;br /&gt;        MsgBox ("Pls select Single Column only")&lt;br /&gt;        &lt;br /&gt;    Else&lt;br /&gt;    &lt;br /&gt;        dCol = sCell.Column&lt;br /&gt;        If dCol &lt; sCol Then&lt;br /&gt;            MsgBox ("Select Column within earlier Range")&lt;br /&gt;        ElseIf dCol &gt; lCol Then&lt;br /&gt;            MsgBox ("Select Column within earlier Range")&lt;br /&gt;        Else&lt;br /&gt;            dColumn = 1&lt;br /&gt;        End If&lt;br /&gt;        &lt;br /&gt;    End If&lt;br /&gt;    &lt;br /&gt;    Loop&lt;br /&gt;            &lt;br /&gt;        For cRow = lRow To sRow Step -1&lt;br /&gt;            If IsEmpty(Cells(cRow, dCol)) = False Then&lt;br /&gt;                If WorksheetFunction.CountIf(Range(Cells(sRow, dCol), Cells(cRow, dCol)), Cells(cRow, dCol).Text) &gt; 1 Then&lt;br /&gt;                    Range(Cells(cRow, sCol), Cells(cRow, lCol)).Select&lt;br /&gt;                    Selection.Interior.Color = 255&lt;br /&gt;                    D = D + 1&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;        Next cRow&lt;br /&gt;    &lt;br /&gt;        Cells(sRow, sCol).Select&lt;br /&gt;        &lt;br /&gt;        If D = 0 Then&lt;br /&gt;    &lt;br /&gt;            MsgBox ("No Duplicate Values Found")&lt;br /&gt;    &lt;br /&gt;        Else&lt;br /&gt;    &lt;br /&gt;            caution = MsgBox(D &amp; " Duplicate entries selected and marked RED" &amp; vbCrLf &amp; _&lt;br /&gt;            "Do you want to delete them? " &amp; vbCrLf &amp; _&lt;br /&gt;            "Marked entries will be deleted and data will move up " &amp; vbCrLf &amp; _&lt;br /&gt;            "Do you want to Continue?", vbYesNo, "Confirmation")&lt;br /&gt;    &lt;br /&gt;            If caution = vbYes Then&lt;br /&gt;                &lt;br /&gt;                For cRow = lRow To sRow Step -1&lt;br /&gt;                    If IsEmpty(Cells(cRow, dCol)) = False Then&lt;br /&gt;                        If WorksheetFunction.CountIf(Range(Cells(sRow, dCol), Cells(cRow, dCol)), Cells(cRow, dCol).Text) &gt; 1 Then&lt;br /&gt;                            Range(Cells(cRow, sCol), Cells(cRow, lCol)).Select&lt;br /&gt;                            Selection.Delete Shift:=xlUp&lt;br /&gt;                        End If&lt;br /&gt;                    End If&lt;br /&gt;                Next cRow&lt;br /&gt;                Cells(sRow, sCol).Select&lt;br /&gt;            End If&lt;br /&gt;        End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/RemoveDuplicateswithinRange.xls?attredirects=0"&gt;&lt;H3&gt;Download file having macro to find and remove duplicates within a range&lt;/H3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Delete Duplicates , Delete Duplicate , Remove Duplicates , Remove Duplicate , Find Duplicates , Find Duplicate , Excel Delete Duplicates , Remove Duplicates Excel , Remove Duplicate Excel&lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1581006164107634269?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1581006164107634269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-remove-duplicates-excel.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1581006164107634269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1581006164107634269'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-remove-duplicates-excel.html' title='Excel Macros : Remove Duplicates Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8366998759567898695</id><published>2009-09-04T13:56:00.010+05:30</published><updated>2009-11-01T21:59:05.093+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Macro Last Row'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Last Row'/><category scheme='http://www.blogger.com/atom/ns#' term='Find Last Row'/><category scheme='http://www.blogger.com/atom/ns#' term='VBA Last Row'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macros : Find Last Row</title><content type='html'>Many times we need to find out the last row of excel sheet which is used by data. This has many uses such as to &lt;pre&gt;Add new column to the data only up to the last used row of exiting dateAdd new row to the data immediately after the last row so as you do not over write the exiting data.&lt;/Pre&gt;See the code below for the doing the activities as listed above.&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;pre&gt;Sub LastRowOfData()&lt;br /&gt;    &lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    '* Macro recorded by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on September 4, 2009 *&lt;br /&gt;    '***************************************************************************************************&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    If ActiveSheet.AutoFilterMode = True Then&lt;br /&gt;    ActiveSheet.AutoFilterMode = False&lt;br /&gt;    End If&lt;br /&gt;    LastRow = GetLastRowWithData        ' Getting the Row number&lt;br /&gt;    &lt;br /&gt;    Range("C3").Select                  ' Select the header row of the data in new column&lt;br /&gt;    ActiveCell.FormulaR1C1 = "Col 2"    ' Add new column header&lt;br /&gt;    Range("C4").Select                  ' Select the starting column where you need to add data&lt;br /&gt;    ActiveCell.FormulaR1C1 = "XYZ"      ' Add Data Value or Formula&lt;br /&gt;    Range("C4:C" &amp; LastRow).Select      ' This will select the column from starting row to Last row of data&lt;br /&gt;    Selection.FillDown                  ' This will fill the data downwards from First row i.e. Formula or value added by you&lt;br /&gt;    &lt;br /&gt;    Range("B" &amp; LastRow + 1).Select     ' This selects the starting cell of row next to last row of exiting data&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;'********************************************************************&lt;br /&gt;'* UDF to Get Last Row with Data on worksheet                       *&lt;br /&gt;'********************************************************************&lt;br /&gt;Public Function GetLastRowWithData() As Long&lt;br /&gt;&lt;br /&gt;    Dim ExcelLastCell As Object, lRow As Long, lLastDataRow As Long, l As Long&lt;br /&gt;&lt;br /&gt;    Set ExcelLastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)&lt;br /&gt;    lLastDataRow = ExcelLastCell.Row&lt;br /&gt;    lRow = ExcelLastCell.Row&lt;br /&gt;    '&lt;br /&gt;    Do While Application.CountA(ActiveSheet.Rows(lRow)) = 0 And lRow &lt;&gt; 1&lt;br /&gt;        lRow = lRow - 1&lt;br /&gt;    Loop&lt;br /&gt;    '&lt;br /&gt;    lLastDataRow = lRow&lt;br /&gt;&lt;br /&gt;    GetLastRowWithData = lLastDataRow&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;Function GetLastRowWithData gives inaccurate results if you have active filters on the worksheet. That is why I have included code to remove active filters from the worksheet before using this function to get last row of data.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://in.yogeshguptaonline.com/resources/excel-macros/Gettinglastrowofdata.xls?attredirects=0&amp;d=1"target="_blank"&gt;Download sample file to check how it works&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;There is one more option which gives you satisfactory results&lt;br /&gt;&lt;br /&gt;LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row&lt;br /&gt;&lt;br /&gt;Take care to remove filters before using above code&lt;br /&gt;&lt;br /&gt;There are some more options to find last row however are not very reliable as they give you last row of the worksheet irrespective of fact that row could be a empty row.&lt;br /&gt;&lt;br /&gt;LastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row&lt;br /&gt;or&lt;br /&gt;LastRow = Cells.SpecialCells(xlCellTypeLastCell).Row&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Select Last Row , Find Last Row , VBA Last Row , VBA Find Last Row , Excel Last Row&lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8366998759567898695?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8366998759567898695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-find-last-row.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8366998759567898695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8366998759567898695'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/09/excel-macros-find-last-row.html' title='Excel Macros : Find Last Row'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8883032311398413579</id><published>2009-07-25T11:47:00.013+05:30</published><updated>2010-03-05T16:35:29.151+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Hardware Locking for Excel Workbook'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Hardware Locking for excel workbook with VBA</title><content type='html'>Many time we desire that our workbook is locked to work with a particular machine. This can be achieved through Hardware Locking of your workbook using VBA. Some of the avaiable solutions will require you to buy external harware dongles and will cost you good amount of money. &lt;br /&gt;&lt;br /&gt;However if you can lock your workbook with the existing hardware of the machine , you will not need external hardware dongles.&lt;br /&gt;&lt;br /&gt;if you use following Excel function to get Mother Board Serial Number, you can compare the current machines mother board serial number with the desired one. If you know that the desired serial number does not match with current machine you know that there is security voilation and you can close the workbook through VBA. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt; copy this code to regular VBA module&lt;/a&gt; of your workbook &lt;H3&gt;Excel Function to Get Mother Board Serial Number&lt;/H3&gt;&lt;div style="overflow: auto; width: 200x; height: 200px;"&gt;&lt;Pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Public Function MBSerialNumber() As String&lt;br /&gt;Dim objs As Object                                                                                                                     &lt;br /&gt;Dim obj As Object&lt;br /&gt;Dim WMI As Object&lt;br /&gt;Dim sAns As String&lt;br /&gt;Set WMI = GetObject("WinMgmts:")&lt;br /&gt;Set objs = WMI.InstancesOf("Win32_BaseBoard")&lt;br /&gt;For Each obj In objs&lt;br /&gt;    sAns = sAns &amp; obj.SerialNumber&lt;br /&gt;    If sAns &lt; objs.Count Then sAns = sAns &amp; ","&lt;br /&gt;Next&lt;br /&gt;MBSerialNumber = sAns&lt;br /&gt;&lt;br /&gt;End Function&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;After you have placed above function in VBA module. You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Workbook" target="_blank"&gt; copy this code to ThisWorkbook section &lt;/a&gt; of your workbook . This is autoopen macro which compares the MBSerialNumber of current machine with the desired MBSerialNumber. In case it does not mactch, it will close activeworkbook.&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 200px;"&gt;&lt;Pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Private Sub Workbook_Open()&lt;br /&gt;    Set RMBSN = Sheets(1).Range("C4") ' This is whare you have already stored required MBSerialNumber&lt;br /&gt;    If MBSerialNumber &lt;&gt; RMBSN Then   ' Checking if current machine serial number is matching with required&lt;br /&gt;        MsgBox ("Data Security failier, This workbook will close") ' In case it does not match workbook will be closed&lt;br /&gt;        ActiveWorkbook.Save&lt;br /&gt;        ActiveWorkbook.Close&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/harwarelockingforexcelworkbooks.xls?attredirects=0"&gt;&lt;h4&gt;Download Excel file with macro for Hardware Locking for Excel Workbooks&lt;/h4&gt;&lt;/a&gt; and try to open it on your machine and see how it works. This is locked version and you will not be able to open it on your machine.&lt;br /&gt;&lt;br /&gt;However you can down load &lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/harwarelockingforexcelworkbooks-Unlocked.xls?attredirects=0"&gt;Unlocked version of Hardware Locking for Excel Workbooks&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8883032311398413579?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8883032311398413579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/hardware-locking-for-excel-workbook.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8883032311398413579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8883032311398413579'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/hardware-locking-for-excel-workbook.html' title='Hardware Locking for excel workbook with VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-4329317152027788406</id><published>2009-07-18T21:39:00.011+05:30</published><updated>2010-03-05T16:32:05.153+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Forcing users to use updated version'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Excel Macros : VBA Expiry date for Excel Workbook</title><content type='html'>Many times we have a situation where we need to force users to use updated file and stop using the old version of worksheet. The only way to do so is to put expiry date for your workbook. User will not be able to work upon the file once the expiry date is crossed and will be forced to look for updated version.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkBook" target="_blank"&gt; copy this code to ThisWorkbook section &lt;/a&gt; of your workbook .&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 200px;"&gt;&lt;Pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Private Sub Workbook_Open()&lt;br /&gt;    Dim Edate As Date&lt;br /&gt;    Edate = Format("31/08/2009", "DD/MM/YYYY") ' Replace this with the date you want&lt;br /&gt;    If Date &gt; Edate Then&lt;br /&gt;        MsgBox ("This worksheet was valid upto " &amp; Format(Edate, "dd-mmm-yyyy") &amp; " and will be closed")&lt;br /&gt;        ActiveWorkbook.Close&lt;br /&gt;    End If&lt;br /&gt;    If Edate - Date &lt; 30 Then&lt;br /&gt;    MsgBox ("This worksheet expires on " &amp; Format(Edate, "dd-mmm-yyyy") &amp; " You have " &amp; Edate - Date &amp; " Days left ")&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;Once the expiry date is crossed, user will get message and workbook will be closed by macro&lt;br /&gt;Once the expiry date in with next thirty days, user will get warning message about expiry date and number of days left.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://in.yogeshguptaonline.com/resources/excel-macros/Expirydatemacro.xls?attredirects=0&amp;d=1"&gt;&lt;h3&gt;Download file containing Workbook Expiry Date Macro&lt;/H3&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-4329317152027788406?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/4329317152027788406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/excel-macros-vba-expiry-date-for-excel.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4329317152027788406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/4329317152027788406'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/excel-macros-vba-expiry-date-for-excel.html' title='Excel Macros : VBA Expiry date for Excel Workbook'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2333812569127781578</id><published>2009-07-02T15:09:00.072+05:30</published><updated>2010-03-05T16:28:54.625+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Custom Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Numbers to Text'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Convert Numbers to Words'/><title type='text'>Excel Functions : Convert Numbers into Words</title><content type='html'>Many times we need the amount in figures to be converted into words. This is a typical requirement for writing checks or any other financial reports. Microsoft Excel does not have standard function available for this requirement. However there are customised functions available on the Internet. One such solution is available at Allexperts.com. &lt;a href="http://en.allexperts.com/q/Excel-1059/Display-numbers-text.htm" target="_blank"&gt;&lt;h2&gt;Display Numbers to Text. &lt;/h2&gt;&lt;/a&gt;You need to copy this to your &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt;regular macro module&lt;/a&gt;. Once you have added it to your file you can use function SpellNumbers to convert any number into words easily as you use any other function of excel.&lt;br /&gt;&lt;br /&gt;Function available at the net covers USD as currency, whereas I needed it in Indian Rupees. I have modified this to give results in any currency. The revised version gives me results as shown in the screen cast below.&lt;br /&gt;&lt;br /&gt;&lt;p align="center"&gt;&lt;a href="http://www.yogeshguptaonline.com/2009/07/excel-functions-convert-numbers-into.html" target="_blank"&gt;&lt;img alt="Photobucket" src="http://i978.photobucket.com/albums/ae263/yogeshguptaonline/spellcurr.gif" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/SpellCurrency.xls?attredirects=0"&gt;Download excel file having this user defined function to convert numbers to words&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;Make sure that you enable macros to use this function. In case macros are disabled this function will not work in downloaded file&lt;br /&gt;&lt;br /&gt;Syntex for the modified UDF is :-&lt;br /&gt;SpellCurr(MyNumber, MyCurrency, MyCurrencyPlace, MyCurrencyDecimals, MyCurrencyDecimalsPlace)&lt;br /&gt;&lt;br /&gt;where&lt;br /&gt;MyNumber = Numeric Value you need to convert into words&lt;br /&gt;MyCurrency = Name of your Currency - i.e. Dollar for USA&lt;br /&gt;MyCurrencyPlace = Prefix or Suffix the currency, use "P" for Prefix and "S" for Suffix&lt;br /&gt;MyCurrencyDecimals = Name of your Currency Decimals - i.e. Cent for USA&lt;br /&gt;MyCurrencyDecimalsPlace = Prefix or Suffix the currency decimals, use "P" for Prefix and "S" for Suffix&lt;br /&gt;&lt;br /&gt;Modified code given below for those who want to use it. Currency inputs are optional and you will not need to input currency details in case you are using it for Indian Currency. Still this can be used for any currency provided you give currency inputs.&lt;br /&gt;&lt;br /&gt;You will need to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#Regular" target="_blank"&gt;copy this code to regular VBA module&lt;/a&gt; of your workbook&lt;br /&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; HEIGHT: 400px"&gt;&lt;table bgcolor="#777777"&gt;&lt;tbody&gt;&lt;tr bgcolor="#aaaaaa"&gt;&lt;td&gt;&lt;pre&gt;Function SpellCurr(ByVal MyNumber, _&lt;br /&gt;Optional MyCurrency As String = "Rupee", _&lt;br /&gt;Optional MyCurrencyPlace As String = "P", _&lt;br /&gt;Optional MyCurrencyDecimals As String = "Paisa", _&lt;br /&gt;Optional MyCurrencyDecimalsPlace As String = "S")&lt;br /&gt;&lt;br /&gt;'*****************************************************************************************************************&lt;br /&gt;'* Based on SpellNumbers UDF by Microsoft, Which handles only Dollars as currency                                *&lt;br /&gt;'* UDF modfied by Yogesh Gupta, smiley123z@gmail.com, Ygblogs.blogspot.com on July 21, 2009                      *&lt;br /&gt;'* UDF modified on September 04, 2009 to make currency inputs optional, by default it will use Indian Currency   *&lt;br /&gt;'* This modified UDF can be used for any currency in case you provide for currency inputs                        *&lt;br /&gt;'* User can define the Prefix and Sufix place for Currency and CurrencyDecimals                                  *&lt;br /&gt;'* MyNumber = Numeric Value you need to convert into words                                                       *&lt;br /&gt;'* MyCurrency = Name of your Currency - i.e. Dollar for USA                                                      *&lt;br /&gt;'* MyCurrencyPlace = Prefix or Suffix the currency, use "P" for Prefix and "S" for Suffix                        *&lt;br /&gt;'* MyCurrencyDecimals = Name of your Currency Decimals - i.e. Cent for USA                                       *&lt;br /&gt;'* MyCurrencyDecimalsPlace = Prefix or Suffix the currency decimals, use "P" for Prefix and "S" for Suffix       *&lt;br /&gt;'*****************************************************************************************************************&lt;br /&gt;&lt;br /&gt;          Dim Rupees, Paisa, Temp&lt;br /&gt;          Dim DecimalPlace, Count&lt;br /&gt;    &lt;br /&gt;          ReDim Place(9) As String&lt;br /&gt;          Place(2) = " Thousand "&lt;br /&gt;          Place(3) = " Million "&lt;br /&gt;          Place(4) = " Billion "&lt;br /&gt;          Place(5) = " Trillion "&lt;br /&gt;      &lt;br /&gt;          'String representation of amount.&lt;br /&gt;          MyNumber = Trim(Str(MyNumber))&lt;br /&gt;      &lt;br /&gt;          'Position of decimal place 0 if none.&lt;br /&gt;          DecimalPlace = InStr(MyNumber, ".")&lt;br /&gt;      &lt;br /&gt;          ' Convert Paisa and set MyNumber to Rupee amount.&lt;br /&gt;          If DecimalPlace &gt; 0 Then&lt;br /&gt;              Paisa = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) &amp;amp; _&lt;br /&gt;                  "00", 2))&lt;br /&gt;              MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))&lt;br /&gt;          End If&lt;br /&gt;&lt;br /&gt;          Count = 1&lt;br /&gt;&lt;br /&gt;          Do While MyNumber &lt;&gt; ""&lt;br /&gt;              Temp = GetHundreds(Right(MyNumber, 3))&lt;br /&gt;              If Temp &lt;&gt; "" Then Rupees = Temp &amp;amp; Place(Count) &amp;amp; Rupees&lt;br /&gt;              If Len(MyNumber) &gt; 3 Then&lt;br /&gt;                  MyNumber = Left(MyNumber, Len(MyNumber) - 3)&lt;br /&gt;              Else&lt;br /&gt;                  MyNumber = ""&lt;br /&gt;              End If&lt;br /&gt;              Count = Count + 1&lt;br /&gt;&lt;br /&gt;          Loop&lt;br /&gt;        &lt;br /&gt;            If MyCurrencyPlace = "P" Then&lt;br /&gt;                Select Case Rupees&lt;br /&gt;                    Case ""&lt;br /&gt;                        Rupees = MyCurrency &amp;amp; "s" &amp;amp; " Zero"&lt;br /&gt;                    Case "One"&lt;br /&gt;                        Rupees = MyCurrency &amp;amp; " One"&lt;br /&gt;                    Case Else&lt;br /&gt;                        Rupees = MyCurrency &amp;amp; "s " &amp;amp; Rupees&lt;br /&gt;                End Select&lt;br /&gt;            Else&lt;br /&gt;                Select Case Rupees&lt;br /&gt;                    Case ""&lt;br /&gt;                        Rupees = "Zero " &amp;amp; MyCurrency &amp;amp; "s"&lt;br /&gt;                    Case "One"&lt;br /&gt;                        Rupees = "One " &amp;amp; MyCurrency&lt;br /&gt;                    Case Else&lt;br /&gt;                        Rupees = Rupees &amp;amp; " " &amp;amp; MyCurrency &amp;amp; "s"&lt;br /&gt;                End Select&lt;br /&gt;            End If&lt;br /&gt;        &lt;br /&gt;          If MyCurrencyDecimalsPlace = "S" Then&lt;br /&gt;                Select Case Paisa&lt;br /&gt;                    Case ""&lt;br /&gt;                        Paisa = " Only"&lt;br /&gt;                    Case "One"&lt;br /&gt;                        Paisa = " and One " &amp;amp; MyCurrencyDecimals &amp;amp; " Only"&lt;br /&gt;                    Case Else&lt;br /&gt;                        Paisa = " and " &amp;amp; Paisa &amp;amp; " " &amp;amp; MyCurrencyDecimals &amp;amp; "s Only"&lt;br /&gt;                End Select&lt;br /&gt;          Else&lt;br /&gt;                Select Case Paisa&lt;br /&gt;                    Case ""&lt;br /&gt;                        Paisa = " Only"&lt;br /&gt;                    Case "One"&lt;br /&gt;                        Paisa = " and " &amp;amp; MyCurrencyDecimals &amp;amp; " One " &amp;amp; " Only"&lt;br /&gt;                    Case Else&lt;br /&gt;                        Paisa = " and " &amp;amp; MyCurrencyDecimals &amp;amp; "s " &amp;amp; Paisa &amp;amp; " Only"&lt;br /&gt;                End Select&lt;br /&gt;          End If&lt;br /&gt;      &lt;br /&gt;          SpellCurr = Rupees &amp;amp; Paisa&lt;br /&gt;&lt;br /&gt;      End Function&lt;br /&gt;&lt;br /&gt;      '*******************************************&lt;br /&gt;      ' Converts a number from 100-999 into text *&lt;br /&gt;      '*******************************************&lt;br /&gt;  &lt;br /&gt;      Function GetHundreds(ByVal MyNumber)&lt;br /&gt;          Dim Result As String&lt;br /&gt;          If Val(MyNumber) = 0 Then Exit Function&lt;br /&gt;          MyNumber = Right("000" &amp;amp; MyNumber, 3)&lt;br /&gt;          ' Convert the hundreds place.&lt;br /&gt;          If Mid(MyNumber, 1, 1) &lt;&gt; "0" Then&lt;br /&gt;              Result = GetDigit(Mid(MyNumber, 1, 1)) &amp;amp; " Hundred "&lt;br /&gt;          End If&lt;br /&gt;&lt;br /&gt;          ' Convert the tens and ones place.&lt;br /&gt;          If Mid(MyNumber, 2, 1) &lt;&gt; "0" Then&lt;br /&gt;              Result = Result &amp;amp; GetTens(Mid(MyNumber, 2))&lt;br /&gt;          Else&lt;br /&gt;              Result = Result &amp;amp; GetDigit(Mid(MyNumber, 3))&lt;br /&gt;          End If&lt;br /&gt;          GetHundreds = Result&lt;br /&gt;      End Function&lt;br /&gt;&lt;br /&gt;      '*********************************************&lt;br /&gt;      ' Converts a number from 10 to 99 into text. *&lt;br /&gt;      '*********************************************&lt;br /&gt;     Function GetTens(TensText)&lt;br /&gt;&lt;br /&gt;          Dim Result As String&lt;br /&gt;          Result = ""           ' Null out the temporary function value.&lt;br /&gt;          If Val(Left(TensText, 1)) = 1 Then   ' If value between 10-19...&lt;br /&gt;              Select Case Val(TensText)&lt;br /&gt;                  Case 10: Result = "Ten"&lt;br /&gt;                  Case 11: Result = "Eleven"&lt;br /&gt;                  Case 12: Result = "Twelve"&lt;br /&gt;                  Case 13: Result = "Thirteen"&lt;br /&gt;                  Case 14: Result = "Fourteen"&lt;br /&gt;                  Case 15: Result = "Fifteen"&lt;br /&gt;                  Case 16: Result = "Sixteen"&lt;br /&gt;                  Case 17: Result = "Seventeen"&lt;br /&gt;                  Case 18: Result = "Eighteen"&lt;br /&gt;                  Case 19: Result = "Nineteen"&lt;br /&gt;                  Case Else&lt;br /&gt;              End Select&lt;br /&gt;          Else                                 ' If value between 20-99...&lt;br /&gt;              Select Case Val(Left(TensText, 1))&lt;br /&gt;                  Case 2: Result = "Twenty "&lt;br /&gt;                  Case 3: Result = "Thirty "&lt;br /&gt;                  Case 4: Result = "Forty "&lt;br /&gt;                  Case 5: Result = "Fifty "&lt;br /&gt;                  Case 6: Result = "Sixty "&lt;br /&gt;                  Case 7: Result = "Seventy "&lt;br /&gt;                  Case 8: Result = "Eighty "&lt;br /&gt;                  Case 9: Result = "Ninety "&lt;br /&gt;                  Case Else&lt;br /&gt;              End Select&lt;br /&gt;&lt;br /&gt;              Result = Result &amp;amp; GetDigit _&lt;br /&gt;                  (Right(TensText, 1))  ' Retrieve ones place.&lt;br /&gt;          End If&lt;br /&gt;          GetTens = Result&lt;br /&gt;      End Function&lt;br /&gt;&lt;br /&gt;      '*******************************************&lt;br /&gt;      ' Converts a number from 1 to 9 into text. *&lt;br /&gt;      '*******************************************&lt;br /&gt; &lt;br /&gt;      Function GetDigit(Digit)&lt;br /&gt;          Select Case Val(Digit)&lt;br /&gt;              Case 1: GetDigit = "One"&lt;br /&gt;              Case 2: GetDigit = "Two"&lt;br /&gt;              Case 3: GetDigit = "Three"&lt;br /&gt;              Case 4: GetDigit = "Four"&lt;br /&gt;              Case 5: GetDigit = "Five"&lt;br /&gt;              Case 6: GetDigit = "Six"&lt;br /&gt;              Case 7: GetDigit = "Seven"&lt;br /&gt;              Case 8: GetDigit = "Eight"&lt;br /&gt;              Case 9: GetDigit = "Nine"&lt;br /&gt;              Case Else: GetDigit = ""&lt;br /&gt;          End Select&lt;br /&gt;      End Function&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;pre&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Numbers to Words , Convert Number to Words , Convert Number to Word , Number to Words , Number to Word , Number to Text , Number in Words , Number to Letters , Convert Number to Text , VBA Number to Text , Number to Text Function , Numeric to Text &lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2333812569127781578?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2333812569127781578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/excel-functions-convert-numbers-into.html#comment-form' title='171 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2333812569127781578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2333812569127781578'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/07/excel-functions-convert-numbers-into.html' title='Excel Functions : Convert Numbers into Words'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>171</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2528366031887345373</id><published>2009-05-10T20:13:00.011+05:30</published><updated>2009-09-22T17:15:52.433+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with Data Range'/><title type='text'>Macros in Excel : Selecting Multiple Ranges in Excel VBA</title><content type='html'>Selecting multiple ranges in Excel VBA helps your code to work faster. You can select multiple ranges in single line code and perform the action you want to perform.&lt;br /&gt;&lt;br /&gt;Normally we code a range by writing it within "" as under&lt;br /&gt;&lt;pre&gt;Range("A1:A10").Select &lt;/Pre&gt;However if you put , between multiple ranges within the same line of the code you can select multiple ranges as given under&lt;br /&gt;&lt;pre&gt;Range("A1:A10,D1:D10,F1:F10").Select &lt;/Pre&gt;&lt;h3&gt;How to use Multiple Ranges in Excel VBA &lt;/H3&gt;Following macro code will explain you how to use multiple ranges in Excel VBA&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 200px;"&gt;&lt;pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Sub Multiple_ranges()&lt;br /&gt;Range("A1:A10").Select                                                                                                       &lt;br /&gt;MsgBox ("Single Range Selected")&lt;br /&gt;Range("A1:A10,D1:D10,F1:F10").Select&lt;br /&gt;MsgBox ("Multiple Ranges Selected")&lt;br /&gt;Selection.Copy&lt;br /&gt;Range("A11").Select&lt;br /&gt;ActiveSheet.Paste&lt;br /&gt;End Sub &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;In the above macro we have selected range three different ranges&lt;br /&gt;&lt;br /&gt;A1:A10&lt;br /&gt;D1:D10&lt;br /&gt;F1:F10&lt;br /&gt;&lt;br /&gt;After selection we have copied the contents to Range A11. Another option for doing this was to copy the contents one by one for each of the range. However copy and paste is only one of the example you can use this for any desired action by you.&lt;br /&gt;&lt;br /&gt;&lt;H3&gt;You can combine multiple ranges into one Range object using the Union method.&lt;/H3&gt;&lt;br /&gt;The following example creates a Range object called myMultipleRange, defines it as the ranges A1:B2 and C3:D4, and then formats the combined ranges as bold.&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 150px;"&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;&lt;pre&gt;&lt;br /&gt;Sub MultipleRange()&lt;br /&gt;    Dim r1, r2, myMultipleRange As Range&lt;br /&gt;    Set r1 = Sheets("Sheet1").Range("A1:B2")&lt;br /&gt;    Set r2 = Sheets("Sheet1").Range("C3:D4")&lt;br /&gt;    Set myMultipleRange = Union(r1, r2)&lt;br /&gt;    myMultipleRange.Font.Bold = True&lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2528366031887345373?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2528366031887345373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/05/macros-in-excel-selecting-multiple.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2528366031887345373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2528366031887345373'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/05/macros-in-excel-selecting-multiple.html' title='Macros in Excel : Selecting Multiple Ranges in Excel VBA'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1320010117160402785</id><published>2009-05-03T21:30:00.013+05:30</published><updated>2010-03-05T16:21:54.748+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Forcing users to Enable Macros'/><title type='text'>Macros in Excel : Forcing Users to Enable Macros</title><content type='html'>Many times we face issue of disable macros situation while the user is using our project. Since the macros are disabled, there is no way that the macros in your project will work the dessired way. However you can force your users to enable macros while working with your files. Simplest way is to hide the main sheet in your project using xlVeryHidden property in your macro. The workseets hidden by using this method can be made visible only by using VBA. The unhide workseet dialog box does not display the names of sheets hidden by using VBA with xlVeryHidden property.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/Sf3CQ9aYExI/AAAAAAAAAG8/fZuGOnzWbZo/s1600-h/This+workbook+VBA+code.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5331631130495423250" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; WIDTH: 200px; CURSOR: hand; HEIGHT: 71px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/Sf3CQ9aYExI/AAAAAAAAAG8/fZuGOnzWbZo/s400/This+workbook+VBA+code.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You need to have one sheet which displays message that macros are disabled and needs to be enabled to use this file. Once the macros are enabled, the message sheets can be hidden and data sheets can be made visible. You can copy the following code to &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkBook" target="_blank"&gt;Thisworkbook section&lt;/a&gt; of your VBA project.&lt;br /&gt;&lt;pre&gt; Private Sub Workbook_BeforeClose(Cancel As Boolean)&lt;br /&gt;   &lt;br /&gt;    Sheets("Msg").Visible = True&lt;br /&gt;    Sheets("Data").Visible = xlVeryHidden&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;&lt;br /&gt;    Sheets("Data").Visible = True&lt;br /&gt;    Sheets("Msg").Visible = xlVeryHidden&lt;br /&gt;&lt;br /&gt;End Sub&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;First macro code makes Msg Sheet visible and hides Data Sheet. This macros runs on even of closing the workbook. Second macro makes Data Sheet Visible and hides Msg Sheet. This macro runs on even of opening of workbook.&lt;br /&gt;&lt;br /&gt;You can add following line to first macro to compulsoraly save the workbook before closure. However use this only if you are sure that it is okay to save the file before closing.&lt;br /&gt;&lt;pre&gt;   ActiveWorkbook.Save&lt;/pre&gt;&lt;br /&gt;In case you have multiple sheets and you want to hide all the sheets except the Msg sheet, use following code in &lt;a href="http://www.yogeshguptaonline.com/2010/03/excel-vba-deploy-macros-found-elsewhere.html#WorkBook" target="_blank"&gt;ThisWorkbook Module&lt;/a&gt;. Make sure that the Msg sheet is first sheet of your workbook. Following code will keep first sheet visible on close and Unhide all other sheets and hide first sheet on open.&lt;br /&gt;&lt;div style="OVERFLOW: auto; HEIGHT: 400px"&gt;&lt;pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tbody&gt;&lt;tr bgcolor="#aaaaaa"&gt;&lt;td&gt;Private Sub Workbook_BeforeClose(Cancel As Boolean)&lt;br /&gt;&lt;br /&gt;Dim myCount 'This line of code is optional&lt;br /&gt;Dim i 'This line of code is optional&lt;br /&gt;On Error Resume Next&lt;br /&gt;myCount = Application.Sheets.Count&lt;br /&gt;&lt;br /&gt;Sheets(1).Visible = True&lt;br /&gt;Range("A1").Select&lt;br /&gt;For i = 2 To myCount&lt;br /&gt;Sheets(i).Visible = xlVeryHidden&lt;br /&gt;If i = myCount Then&lt;br /&gt;End If&lt;br /&gt;Next i&lt;br /&gt;ActiveWorkbook.Save&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;&lt;br /&gt;Dim myCount 'This line of code is optional&lt;br /&gt;Dim i 'This line of code is optional&lt;br /&gt;On Error Resume Next&lt;br /&gt;&lt;br /&gt;myCount = Application.Sheets.Count&lt;br /&gt;For i = 2 To myCount&lt;br /&gt;Sheets(i).Visible = True&lt;br /&gt;If i = myCount Then&lt;br /&gt;Sheets(1).Visible = xlVeryHidden&lt;br /&gt;End If&lt;br /&gt;Next i&lt;br /&gt;&lt;br /&gt;End Sub &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sites.google.com/a/yogeshguptaonline.com/resources/excel-macros/Forceenablemacros.xls?attredirects=0"&gt;Download file with Macro code to Force users to Enable Macros&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Code above is simplest way to force normal users to enable macros and make your project file work the way you want them to. However the advanced users can always get into your project by using VBA routine stored in onother file. This can be done by following the steps as given below.&lt;br /&gt;&lt;br /&gt;1. Open the project file while the Macros are disabled.&lt;br /&gt;2. Encable the Macros.&lt;br /&gt;3. Unhide the hidden sheets in project file by macros code in another file&lt;br /&gt;&lt;br /&gt;There are ways and means to overcome this situation also, but a advanced user will find a way to get into your project if they realy want to. So I feel there is no need to complecate the code for keeping them away. You can always make normal users to use your project file the way you want them to by using simpe code given above&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1320010117160402785?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1320010117160402785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/05/macros-in-excel-forcing-users-to-enable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1320010117160402785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1320010117160402785'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/05/macros-in-excel-forcing-users-to-enable.html' title='Macros in Excel : Forcing Users to Enable Macros'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/Sf3CQ9aYExI/AAAAAAAAAG8/fZuGOnzWbZo/s72-c/This+workbook+VBA+code.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5055983946759947433</id><published>2009-04-28T21:18:00.005+05:30</published><updated>2009-11-01T13:17:05.989+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Learn Excel VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Basic Grammar'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Learn Excel VBA : Variables</title><content type='html'>This is continuation of my earlier posts on &lt;br /&gt;&lt;Pre&gt;   &lt;a href="http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html"&gt;Macros in Excel : Learn Excel VBA : Objects&lt;/a&gt; &lt;br /&gt;   &lt;a href="http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba-methods.html"&gt;Macros in Excel : Learn Excel VBA : Methods&lt;/a&gt;&lt;br /&gt;   &lt;a href="http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba.html"&gt;Macros in Excel : Learn Excel VBA : Properties&lt;/a&gt;&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;It is not necessary to declare a variable in VBA, Visual Basic automatically creates storage for a variable on first use in the code. Automatically created variables are of type variant and can contain any type of data. It can be strings, boolean values, object , arrays or numbers.&lt;br /&gt;&lt;br /&gt;Simple statement such as given below creates a variable and assigns value to it&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt; Myvariable = 28 &lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;Similarly you can use different variables in calculation to create another variable for your VBA code. Following code will explain the use of Variables in Excel VBA&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt;Sub Explain_Variables()&lt;br /&gt;&lt;br /&gt;Var_A = 10&lt;br /&gt;Range("A4").Select ' Value of Cell A4 is 5&lt;br /&gt;Var_B = ActiveCell&lt;br /&gt;&lt;br /&gt;Var_Total = Var_A + Var_B&lt;br /&gt;&lt;br /&gt;Range("A5") = Var_Total&lt;br /&gt;&lt;br /&gt;End Sub&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;This code explains that &lt;br /&gt;&lt;br /&gt;1. Var_A is declared as constant number in the code itself. &lt;br /&gt;2. Var_B is declared as value in ActiveCell i.e. Cell A4 in this case with Value as number 5. &lt;br /&gt;3. We have used Var_A and Var_B to calculated Var_Total&lt;br /&gt;4. We have used Var_Total to update the value in Cell A5, the result of this code is number 15 in Cell A5&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5055983946759947433?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5055983946759947433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba_28.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5055983946759947433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5055983946759947433'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba_28.html' title='Macros in Excel : Learn Excel VBA : Variables'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6411258378283913193</id><published>2009-04-16T22:08:00.011+05:30</published><updated>2009-09-20T12:50:49.914+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Auto Open Macro'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Auto Open Macro / Auto Run Macro</title><content type='html'>Many times we want certain task to be executed when you open a particular file. This can be achieved by auto open macro or auto run macro. This is the macro which executes itself when you open a excel file.&lt;br /&gt;&lt;br /&gt;There are two methods to do this&lt;br /&gt;&lt;br /&gt;&lt;H3&gt; Method 1. Auto open macro in VBA Project Module &lt;/H3&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/Sedf_tUXJMI/AAAAAAAAAGs/Xq-NczQ99AA/s1600-h/Auto_open+file_VBA+Module.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 82px;" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/Sedf_tUXJMI/AAAAAAAAAGs/Xq-NczQ99AA/s400/Auto_open+file_VBA+Module.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5325330632490296514" /&gt;&lt;/a&gt; In this case you add your macro code to VBA project module and it gets executed when you open the file. When you go to your VBA editor, you select a module as highlighted in the picture and copy following code to have auto run macro.&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt;Private Sub Auto_Open()&lt;br /&gt;&lt;br /&gt;MsgBox "This is auto open macro in Module"&lt;br /&gt;&lt;br /&gt;End Sub &lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;H3&gt; Method 2. Auto open macro in ThisWorkbook Section &lt;/H3&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sedh-CmfOcI/AAAAAAAAAG0/7TBcsPNSyHw/s1600-h/This+workbook+VBA+code.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px; height: 71px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sedh-CmfOcI/AAAAAAAAAG0/7TBcsPNSyHw/s400/This+workbook+VBA+code.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5325332802866985410" /&gt;&lt;/a&gt;In this method you add your code to Thisworkbook Section of your excel file. double click on highlighted potion in your VBA editor and paste following code&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt;Private Sub Workbook_Open()&lt;br /&gt;&lt;br /&gt;MsgBox "This is auto open macro in This workbook"&lt;br /&gt;&lt;br /&gt;End Sub &lt;/Pre&gt;&lt;br /&gt;You can replace the message box line with your code / action you want your macro to do. I have used this as example to keep my macro code short for better understanding.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt; Auto open Macro , Excel auto open macro , Auto run macro , Auto open excel , VBA excel workbook open &lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6411258378283913193?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6411258378283913193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-auto-open-macro-auto.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6411258378283913193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6411258378283913193'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-auto-open-macro-auto.html' title='Macros in Excel : Auto Open Macro / Auto Run Macro'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/Sedf_tUXJMI/AAAAAAAAAGs/Xq-NczQ99AA/s72-c/Auto_open+file_VBA+Module.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5512006533202106601</id><published>2009-04-15T09:03:00.007+05:30</published><updated>2009-09-20T12:59:51.761+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Disable right click menu'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Disable Right Click Menu</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/SeVWDdUqQfI/AAAAAAAAAGk/ZrJKes5GicM/s1600-h/This+workbook+VBA+code.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 71px;" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/SeVWDdUqQfI/AAAAAAAAAGk/ZrJKes5GicM/s400/This+workbook+VBA+code.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5324756751846359538" /&gt;&lt;/a&gt;&lt;br /&gt;Many times we need to disable right click menu in our workbook. We can achieve this by using Marcos in Excel. You need to add the Macro code to This workbook section in your VBA project. When you go to your Visual Basic Editor you can see the ThisWorkbook on the left hand side of your VBA Project.&lt;br /&gt;&lt;br /&gt;You need to double click on highlighed portion and copy the following code. Since these macros has Private word before Sub, no one will be able to see this macros from View Macro menu.&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 100px;"&gt;&lt;Pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)&lt;br /&gt;Cancel = True&lt;br /&gt;MsgBox "Right click menu deactivated." &amp; vbCrLf &amp; _&lt;br /&gt;"For this file:", 16, ""&lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5512006533202106601?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5512006533202106601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-disable-right-click.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5512006533202106601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5512006533202106601'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-disable-right-click.html' title='Macros in Excel : Disable Right Click Menu'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/SeVWDdUqQfI/AAAAAAAAAGk/ZrJKes5GicM/s72-c/This+workbook+VBA+code.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-7170438104036149246</id><published>2009-04-14T19:32:00.015+05:30</published><updated>2009-11-01T13:05:07.618+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Disable Cut Copy Paste in Excel'/><title type='text'>Macros in Excel : Disable Cut Copy Paste</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SeSat3iQ2qI/AAAAAAAAAGc/0_YM7cTHZMI/s1600-h/This+workbook+VBA+code.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px; height: 71px;" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SeSat3iQ2qI/AAAAAAAAAGc/0_YM7cTHZMI/s400/This+workbook+VBA+code.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5324550772251220642" /&gt;&lt;/a&gt;&lt;br /&gt;Many times we need to disable Cut Copy and Paste in our workbook. You can achieve this by using Marcos in Excel. You need to add the Macro code to This workbook section in your VBA project. When you go to your Visual Basic Editor you can see the ThisWorkbook on the left hand side of your VBA Project.&lt;br /&gt;&lt;br /&gt;You need to double click on highlighed portion and copy the following code. This code also disables the rightclick menu. Since these macros has Private word before Sub, no one will be able to see these macros from View Macro menu.&lt;br /&gt;&lt;div style="overflow: auto; width: 200x; height: 400px;"&gt;&lt;Pre&gt;&lt;table bgcolor="#777777"&gt;&lt;tr bgcolor="#AAAAAA"&gt;&lt;td&gt;Private Sub Workbook_BeforeClose(Cancel As Boolean)&lt;br /&gt;On Error Resume Next&lt;br /&gt;With Application&lt;br /&gt;.CellDragAndDrop = True&lt;br /&gt;.OnKey "^c"&lt;br /&gt;.OnKey "^v"&lt;br /&gt;.OnKey "^x"&lt;br /&gt;.OnKey "+{DEL}"&lt;br /&gt;.OnKey "^{INSERT}"&lt;br /&gt;.CutCopyMode = False&lt;br /&gt;End With&lt;br /&gt;Dim Ctrl As Office.CommandBarControl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=19) 'copy&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=21) ' Cut&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=22) ' Paste&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=755) ' Paste Special&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    With Application&lt;br /&gt;    .CutCopyMode = False&lt;br /&gt;    .CellDragAndDrop = False&lt;br /&gt;    .OnKey "^c", ""&lt;br /&gt;    .OnKey "^v", ""&lt;br /&gt;    .OnKey "^x", ""&lt;br /&gt;    .OnKey "+{DEL}", ""&lt;br /&gt;    .OnKey "^{INSERT}", ""&lt;br /&gt;    End With&lt;br /&gt;   &lt;br /&gt;    Dim Ctrl As Office.CommandBarControl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=19) ' Copy&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=21) ' Cut&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=22) ' Paste&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=755) ' Paste Special&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    &lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Activate()&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    With Application&lt;br /&gt;    .CutCopyMode = False&lt;br /&gt;    .CellDragAndDrop = False&lt;br /&gt;    .OnKey "^c", ""&lt;br /&gt;    .OnKey "^v", ""&lt;br /&gt;    .OnKey "^x", ""&lt;br /&gt;    .OnKey "+{DEL}", ""&lt;br /&gt;    .OnKey "^{INSERT}", ""&lt;br /&gt;    End With&lt;br /&gt;    Dim Ctrl As Office.CommandBarControl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=19) ' Copy&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=21) ' Cut&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=22) ' Paste&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=755) ' Paste Special&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;   &lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)&lt;br /&gt;Cancel = True&lt;br /&gt;MsgBox "Right click menu deactivated." &amp; vbCrLf &amp; _&lt;br /&gt;"For this file:", 16, ""&lt;br /&gt;End Sub&lt;br /&gt;Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)&lt;br /&gt;     Application.CutCopyMode = False&lt;br /&gt;End Sub&lt;br /&gt;Private Sub Workbook_SheetActivate(ByVal Sh As Object)&lt;br /&gt;    &lt;br /&gt;    On Error Resume Next&lt;br /&gt;    With Application&lt;br /&gt;    .CutCopyMode = False&lt;br /&gt;    .CellDragAndDrop = False&lt;br /&gt;    .OnKey "^c", ""&lt;br /&gt;    .OnKey "^v", ""&lt;br /&gt;    .OnKey "^x", ""&lt;br /&gt;    .OnKey "+{DEL}", ""&lt;br /&gt;    .OnKey "^{INSERT}", ""&lt;br /&gt;    End With&lt;br /&gt;    Dim Ctrl As Office.CommandBarControl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=19) ' Copy&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=21) ' Cut&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=22) ' Paste&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    For Each Ctrl In Application.CommandBars.FindControls(ID:=755) ' Paste Special&lt;br /&gt;        Ctrl.Enabled = False&lt;br /&gt;    Next Ctrl&lt;br /&gt;    &lt;br /&gt;End Sub&lt;br /&gt;Private Sub Workbook_Deactivate()&lt;br /&gt;On Error Resume Next&lt;br /&gt;With Application&lt;br /&gt;.CellDragAndDrop = True&lt;br /&gt;.OnKey "^c"&lt;br /&gt;.OnKey "^v"&lt;br /&gt;.OnKey "^x"&lt;br /&gt;.OnKey "+{DEL}"&lt;br /&gt;.OnKey "^{INSERT}"&lt;br /&gt;.CutCopyMode = False&lt;br /&gt;End With&lt;br /&gt;Dim Ctrl As Office.CommandBarControl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=19) ' Copy&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=21) ' Cut&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=22) ' Paste&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;For Each Ctrl In Application.CommandBars.FindControls(ID:=755) ' Paste Special&lt;br /&gt;    Ctrl.Enabled = True&lt;br /&gt;Next Ctrl&lt;br /&gt;&lt;br /&gt;End Sub&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/Pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href="http://in.yogeshguptaonline.com/resources/excel-macros/disablecutcopypaste.xls?attredirects=0"target="_blank"&gt;&lt;H3&gt;Download file having disable cut copy paste Macro&lt;/H3&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-7170438104036149246?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/7170438104036149246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-disable-cut-copy-paste.html#comment-form' title='21 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7170438104036149246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/7170438104036149246'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-disable-cut-copy-paste.html' title='Macros in Excel : Disable Cut Copy Paste'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3QrPv-CwOcc/SeSat3iQ2qI/AAAAAAAAAGc/0_YM7cTHZMI/s72-c/This+workbook+VBA+code.jpg' height='72' width='72'/><thr:total>21</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2240667252349867620</id><published>2009-04-13T16:18:00.010+05:30</published><updated>2009-11-01T12:55:04.336+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Learn Excel VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Basic Grammar'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Learn Excel VBA : Properties</title><content type='html'>This in continuation of my earlier post on &lt;br /&gt;&lt;Pre&gt;   &lt;a href="http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html"&gt;Macros in Excel : Learn Excel VBA : Objects&lt;/a&gt;&lt;br /&gt;   &lt;a href="http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba-methods.html"&gt;Macros in Excel : Learn Excel VBA : Methods&lt;/a&gt;&lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;Each VBA object has its own properties that controls its appearance. When we talk about range as object typical properties are&lt;br /&gt;&lt;Pre&gt;   - ColumnWidth&lt;br /&gt;   - RowHeight&lt;br /&gt;   - Font&lt;br /&gt;   - Text&lt;br /&gt;   - Value&lt;br /&gt;   - Formula&lt;br /&gt;   - Borders&lt;/Pre&gt;&lt;br /&gt;Syntax in your macro is&lt;br /&gt;&lt;Pre&gt;    Object.Property = Value&lt;/Pre&gt;&lt;br /&gt;or &lt;Pre&gt;    Range("A1").RowHeight = 60 &lt;/Pre&gt;&lt;br /&gt;or &lt;Pre&gt;    Range("A1").FormulaR1C1 = "=R[2]C+R[3]C" &lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;Following instruction will set the columon width to 25 &lt;br /&gt;&lt;Pre&gt;    Range("A1").ColumnWidth = 25 &lt;/Pre&gt;&lt;br /&gt;&lt;br /&gt;In case property is on left hand side of = sign it is updated with the new value mentioned on the right hand side of = sign&lt;br /&gt;&lt;br /&gt;In case you have property on the right hand side of = sign it means you are reading value from that object. Following statement will set the column width of Cell A2 as 35 considering that Cell A1 has column widht of 25&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt; Range("A2").ColumnWidth = Range("A1").ColumnWidth + 10 &lt;/Pre&gt;&lt;br /&gt;If you are new to Macros in Excel, Please go through my earlier posts on &lt;br /&gt;&lt;br /&gt;1. &lt;a href="http://www.yogeshguptaonline.com/2009/03/automating-tasks-in-excel-using-macros.html"&gt;Automating Tasks in Excel : Using Macros in Excel&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html"&gt;Recording Excel Macros / Writing excel macros (VBA)&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2240667252349867620?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2240667252349867620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2240667252349867620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2240667252349867620'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba.html' title='Macros in Excel : Learn Excel VBA : Properties'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6648180916975294978</id><published>2009-04-10T07:57:00.015+05:30</published><updated>2009-10-27T21:35:50.828+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Formating Numbers in Excel'/><title type='text'>Custom Formating - Excel Number Format</title><content type='html'>Excel stores numbers as normal numbers only, however you can view them as you want based on how do you format the cells. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/Sd6xcy8OVoI/AAAAAAAAAFM/qqDBEahmec0/s1600-h/Custom+Cell+Formating+Excel+Number.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 399px; height: 375px;" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/Sd6xcy8OVoI/AAAAAAAAAFM/qqDBEahmec0/s400/Custom+Cell+Formating+Excel+Number.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5322886917867329154" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you see there are pre defined number format options available when you choose cell format option, however you can use custom format option if available formats does not server your requirement.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/Sd6yx4s0t2I/AAAAAAAAAFU/J7laYixx8vY/s1600-h/custom+number+format+in+excel.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 387px; height: 67px;" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/Sd6yx4s0t2I/AAAAAAAAAFU/J7laYixx8vY/s400/custom+number+format+in+excel.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5322888379702228834" /&gt;&lt;/a&gt;  &lt;br /&gt;&lt;br /&gt;There are four sections of format codes. The sections are separated by semicolons ";" First section defines the formats for positive numbers; Second section defines negative numbers; third section defines how to show zero values; and forth one define how to diplay text. If you specify only two sections, the first is used for positive numbers and zeros, and the second is used for negative numbers. If you specify only one section, all numbers use that format. If you want to skip a section, include the ending semicolon for that section. &lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sd699c_LkZI/AAAAAAAAAGE/X9_fyEl0_yc/s1600-h/custom+number+format+codes+in+excel.jpg"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 168px;" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/Sd699c_LkZI/AAAAAAAAAGE/X9_fyEl0_yc/s400/custom+number+format+codes+in+excel.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5322900673049366930" /&gt;&lt;/a&gt;&lt;br /&gt;# displays only significant digits and does not display insignificant zeros.&lt;br /&gt;&lt;br /&gt;0 (zero) displays insignificant zeros if a number has fewer digits than there are zeros in the format.&lt;br /&gt;&lt;br /&gt;? adds spaces for insignificant zeros on either side of the decimal point so that decimal points align. &lt;br /&gt;&lt;br /&gt;? can also be used for fractions that have varying numbers of digits.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6648180916975294978?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6648180916975294978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/custom-formating-excel-number-format.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6648180916975294978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6648180916975294978'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/custom-formating-excel-number-format.html' title='Custom Formating - Excel Number Format'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3QrPv-CwOcc/Sd6xcy8OVoI/AAAAAAAAAFM/qqDBEahmec0/s72-c/Custom+Cell+Formating+Excel+Number.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3256769050986885538</id><published>2009-04-08T18:20:00.005+05:30</published><updated>2009-04-08T18:32:19.812+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Kay Board Shortcuts'/><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><title type='text'>Special Symbol Shortcuts Using the ALT Key</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/Sdye7DENgwI/AAAAAAAAAE8/of436W97DeM/s1600-h/Keybord+shortcut+for+special+symbols.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 315px; height: 400px;" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/Sdye7DENgwI/AAAAAAAAAE8/of436W97DeM/s400/Keybord+shortcut+for+special+symbols.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5322303596917523202" /&gt;&lt;/a&gt;&lt;br /&gt;There are some special symbols which we need to use many times but they are not available on the keyboard. We can type them using ALT key and numeric code for the particular symbol&lt;br /&gt;&lt;br /&gt;Pls see the chart for numeric codes for various symbols. If you need to type £ you need to press ALT key and keep it pressed while typing 0163. Release ALT key once you have typed 0163. Immediately on release of ALT key you will see £ sign appearing on your screen. You can follow the same process for getting other symbols by typing the relevant numeric code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3256769050986885538?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3256769050986885538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/special-symbol-shortcuts-using-alt-key.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3256769050986885538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3256769050986885538'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/special-symbol-shortcuts-using-alt-key.html' title='Special Symbol Shortcuts Using the ALT Key'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_3QrPv-CwOcc/Sdye7DENgwI/AAAAAAAAAE8/of436W97DeM/s72-c/Keybord+shortcut+for+special+symbols.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3647347898476366719</id><published>2009-04-03T13:32:00.020+05:30</published><updated>2009-11-01T12:49:12.620+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Learn Excel VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Basic Grammar'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Learn Excel VBA : Methods</title><content type='html'>This in continution of my earlier post on &lt;a href="http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html"&gt;Macros in Excel : Learn Excel VBA : Objects&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Visual Basic is an object oriented language. Objects have methods that perform action on them. In case range is the object you are working upon following methods would perform action on range object&lt;br /&gt;&lt;pre&gt;    - Activate&lt;br /&gt;    - Select&lt;br /&gt;    - Cut&lt;br /&gt;    - Copy&lt;br /&gt;    - Clear&lt;br /&gt;    - Delete&lt;br /&gt;    - Paste &lt;/pre&gt;&lt;br /&gt;Syntex of many Visual Basis statements is&lt;br /&gt;&lt;pre&gt;    Objects.Methods &lt;/Pre&gt;&lt;br /&gt;Look at the following code to understand the use of methods in VBA&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt;Sub Explain_Methods()&lt;br /&gt;    Range("C4").Copy&lt;br /&gt;    Range("C8").Select&lt;br /&gt;    ActiveSheet.Paste&lt;br /&gt;   &lt;br /&gt;End Sub &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you are new to &lt;a href="http://ygblogs.blogspot.com/search/label/Macros%20in%20Excel"&gt;Macros in Excel&lt;/a&gt; I suggest that you go through earlier posts on Macros&lt;br /&gt;1. &lt;a href="http://www.yogeshguptaonline.com/2009/03/automating-tasks-in-excel-using-macros.html"&gt;Automating Tasks in Excel : Using Macros in Excel&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html"&gt;Recording Excel Macros / Writing excel macros (VBA)&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html"&gt;Macros in Excel : Learn Excel VBA : Objects&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3647347898476366719?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='text/html' href='http://ygblogs.blogspot.com/2009/03/macros-in-excel-learn-excel-vba-objects.html' length='0'/><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3647347898476366719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3647347898476366719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3647347898476366719'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/04/macros-in-excel-learn-excel-vba-methods.html' title='Macros in Excel : Learn Excel VBA : Methods'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6692509029764578198</id><published>2009-03-28T20:05:00.010+05:30</published><updated>2009-09-15T10:50:41.732+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with Data Range'/><title type='text'>Macros in Excel : Pivot Table with Dynamic Data Range</title><content type='html'>One common issue while creating / recording a macro for Pivot table is the data range of Pivot table gets recorded. Next time when you use the same macro data range for the pivot table will be same as it was at the time of recording of macro. If you do not notice this the report created by macro may represent wrong picture. This may be due to increase in the data size. &lt;br /&gt;&lt;br /&gt;However there is a way to overcome this problem by using &lt;a href="http://ygblogs.blogspot.com/2008/12/defining-dynamic-ranges-range-names.html"&gt;dynamic data range &lt;/a&gt;with the help of &lt;a href="http://ygblogs.blogspot.com/2008/12/defining-dynamic-ranges-range-names.html"&gt;Excel Offset Function&lt;/a&gt;. Before creating the pivot by macro you need to create dynamic data range using offset function. &lt;br /&gt;&lt;br /&gt;Then you create a Pivot with the named range. &lt;br /&gt;&lt;br /&gt;See the macro code given below for better understanding&lt;br /&gt;&lt;pre&gt;Sub Pivot_with_Dynamic_range()&lt;br /&gt;' This creates Dynamic data range named "PvtData"&lt;br /&gt;&lt;br /&gt;ActiveWorkbook.Names.Add Name:="PvtData", RefersToR1C1:= _&lt;br /&gt;"=OFFSET('Data'!R2C1,0,0,COUNTA('Data'!C1),COUNTA('Data'!R2))"&lt;br /&gt;&lt;br /&gt;' This creates Pivot using Dynamic data range named "PvtData"&lt;br /&gt;&lt;br /&gt;ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _&lt;br /&gt;"PvtData").CreatePivotTable TableDestination:="", TableName:="PivotTable1"&lt;br /&gt;ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)&lt;br /&gt;ActiveSheet.Cells(3, 1).Select&lt;br /&gt;ActiveSheet.PivotTables("PivotTable1").SmallGrid = False&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/Pre&gt;&lt;br /&gt;The above code handles the major issue of dynamic data range and will create blank pivot table for your data, you need to add the required fields to complete your report. In this data is available at Sheet named "Data" and starting point of the data is Row 2 Column 1 or Cell "A2". You will need to change these references while using the above code in your macro.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Macro Pivot Table , Pivottable VBA , Pivot Table VBA , Pivot Table Macro , Dynamic Pivot Table , Pivot Table Dynamic Range &lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6692509029764578198?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6692509029764578198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-pivot-table-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6692509029764578198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6692509029764578198'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-pivot-table-with.html' title='Macros in Excel : Pivot Table with Dynamic Data Range'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8579551957277679864</id><published>2009-03-27T18:47:00.009+05:30</published><updated>2009-11-01T12:45:34.998+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Fill Blank Cells With Data Above</title><content type='html'>In case you need to fill the blank cells within a range with the data above it , use following macro code. Since this works on pre selected range of data, so make sure that you have selected the required data range before running your macro. &lt;br /&gt;&lt;br /&gt;Let us take an example. if you want to fill the blank cells with in range "A2:D10", make sure that you have select this range before running the macro.&lt;br /&gt;&lt;br /&gt;&lt;Pre&gt;Sub Fill_Blank_Cells()&lt;br /&gt;    Selection.SpecialCells(xlCellTypeBlanks).Select&lt;br /&gt;    Selection.FormulaR1C1 = "=R[-1]C"&lt;br /&gt;&lt;br /&gt;End Sub &lt;/Pre&gt;&lt;br /&gt;Please also refer to earlier post on "&lt;a href=" http://www.yogeshguptaonline.com/2008/12/how-to-fill-blank-cells-in-excel-data.html"&gt;How to fill blank cells in excel data range with cells above it&lt;/a&gt;"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8579551957277679864?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8579551957277679864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-fill-blank-cells-with.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8579551957277679864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8579551957277679864'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-fill-blank-cells-with.html' title='Macros in Excel : Fill Blank Cells With Data Above'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-1175118101922601925</id><published>2009-03-26T18:36:00.005+05:30</published><updated>2009-03-26T18:45:00.931+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Find Blank Cells Macro</title><content type='html'>In case you need to select blank cells within range , use following macro code. Since this works on pre selected range of data, so make sure that you have selected the required data range before running your macro. &lt;br /&gt;&lt;br /&gt;Let us take an example. if you want to find blank cells with in "A2:D10", make sure that you have select this range before running the macro.&lt;br /&gt;&lt;Pre&gt;&lt;br /&gt;Sub Find_Blank_Cells()&lt;br /&gt;&lt;br /&gt;    Selection.SpecialCells(xlCellTypeBlanks).Select&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/Pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-1175118101922601925?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/1175118101922601925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-find-blank-cells-macro.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1175118101922601925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/1175118101922601925'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-find-blank-cells-macro.html' title='Macros in Excel : Find Blank Cells Macro'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2357188193594280800</id><published>2009-03-25T08:03:00.009+05:30</published><updated>2009-11-01T12:43:22.888+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Learn Excel VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Basic Grammar'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Learn Excel VBA : Objects</title><content type='html'>It is important to understand Visual Basic Grammar to better understand the macros recorded by you. If you are new to Macros in excel I suggest that you go through earlier posts on Macros&lt;br /&gt;1. &lt;a href="http://www.yogeshguptaonline.com/2009/03/automating-tasks-in-excel-using-macros.html"&gt;Automating Tasks in Excel : Using Macros in Excel&lt;/a&gt;&lt;br /&gt;2. &lt;a href="http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html"&gt;Recording Excel Macros / Writing excel macros (VBA)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Visual Basic is object oriented language, it means all items in Excel are considered as objects. There are lots of them but following example will help us understand what an Object is.&lt;br /&gt;&lt;Pre&gt;&lt;br /&gt;   - WorkBook&lt;br /&gt;   - WorkSheet&lt;br /&gt;   - Range&lt;br /&gt;   - Chart&lt;br /&gt;   - Legend&lt;br /&gt;&lt;/Pre&gt;&lt;br /&gt;In a Macro Range("A1") is an object. An object can contain other objects. &lt;br /&gt;WorkBook is the larger object followed by WorkSheet and Range.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Workbooks("Macros Book.xls").Worksheets("Data").Range("A1")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Code above refers to Cell "A1" on worksheet "Data" in "Macros Book.xls" file. This is long description but can easily be shortened. The worksheet containing the cursor is called Activesheet, similarly workbook containing active sheet is called Activeworkbook&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;ActiveWorkbook.ActiveSheet.Range("A1")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There is no difference in the previous line and line above in your macro code.&lt;br /&gt;&lt;br /&gt;In case you do not refere larger object, Excel Macro will use ActiveWorkBook and ActiveSheet. So if you write Range("A1") it means same if you have your cursor at Worksheet "Data" in "Macros Book.xls" file while running this code.&lt;br /&gt;&lt;br /&gt;Table below will explain the use of various objects on Excel VBA&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;WorkBooks - Referes to all workbooks currently open in Excel&lt;br /&gt;WorkBooks.Item(1) - Referes to first workbook&lt;br /&gt;WorkBooks.(1) - Referes to first workbook&lt;br /&gt;WorkBooks.(Macros Book.xls) - Referes to Macros Book.xls file open&lt;br /&gt;&lt;br /&gt;Sheets - Referes to all sheets in workbook both chart sheets and worksheets&lt;br /&gt;Sheets(1) - Referes First sheet on tab bar.&lt;br /&gt;Sheets("Data") - Refer to Sheet called Data&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2357188193594280800?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2357188193594280800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2357188193594280800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2357188193594280800'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/macros-in-excel-learn-excel-vba-objects.html' title='Macros in Excel : Learn Excel VBA : Objects'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8410535932348511387</id><published>2009-03-21T11:31:00.015+05:30</published><updated>2009-11-01T12:40:27.988+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Write Macros in Excel / Clean or Tweak Excel Macro</title><content type='html'>I am going to cover how to Write excel macro / Clean or tweak recorded excel macro. Those who are not aware about recording excel macro , I suggest them to go through my earlier post on &lt;a href="http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html" target="_blank"&gt;&lt;p style="font-size: 150%;"&gt;1. Recording Excel Macro&lt;/p&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When you record a macro it records many actions which are actually not required. Pls go through the macro code given below recorded by record macro function of excel.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub MergeCells()&lt;br /&gt;    Range("B4:C4").Select&lt;br /&gt;    With Selection&lt;br /&gt;        .HorizontalAlignment = xlCenter&lt;br /&gt;        .VerticalAlignment = xlBottom&lt;br /&gt;        .WrapText = False&lt;br /&gt;        .Orientation = 0&lt;br /&gt;        .AddIndent = False&lt;br /&gt;        .ShrinkToFit = False&lt;br /&gt;        .MergeCells = False&lt;br /&gt;    End With&lt;br /&gt;    Selection.Merge&lt;br /&gt;    With Selection&lt;br /&gt;        .HorizontalAlignment = xlCenter&lt;br /&gt;        .VerticalAlignment = xlBottom&lt;br /&gt;        .WrapText = False&lt;br /&gt;        .Orientation = 0&lt;br /&gt;        .AddIndent = False&lt;br /&gt;        .ShrinkToFit = False&lt;br /&gt;        .MergeCells = False&lt;br /&gt;    End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code is doing three actions&lt;br /&gt;&lt;br /&gt;1.Select dells in range B4:C4&lt;br /&gt;2.Merge selected cells i.e. B4:C4&lt;br /&gt;3.Unmerge selected cells i.e. B4:C4&lt;br /&gt;&lt;br /&gt;If you see there is lots of unwanted action recorded by macro recorder. Similar action can be achieved by cleaning up the unwanted stuff. See the code given below which performs the same action.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub MergeCells_clean()&lt;br /&gt;    Range("B4:C4").Select&lt;br /&gt;    Selection.Merge&lt;br /&gt;    Selection.UnMerge&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once you have recorded your macro , you can lookout for unwanted stuff recorded by it. Cleaning up that will help you understand your macro better and you will be able to maintain your macro for long time.&lt;br /&gt;&lt;br /&gt;Similar action can be achieved by two line code as under :-&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub MergeCells_simple()&lt;br /&gt;    Range("B4:C4").Merge&lt;br /&gt;    Range("B4:C4").UnMerge&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8410535932348511387?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8410535932348511387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/write-excel-macro-clean-or-tweak-excel.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8410535932348511387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8410535932348511387'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/write-excel-macro-clean-or-tweak-excel.html' title='Write Macros in Excel / Clean or Tweak Excel Macro'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2327097879515891960</id><published>2009-03-18T19:23:00.013+05:30</published><updated>2009-03-23T12:36:27.202+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Macros in Excel : Making your macro run every time</title><content type='html'>A macro records your mouse clicks and keystrokes while you work and lets you play them back later. You can use a macro to record the sequence of commands you use to perform a certain task. When you run the macro, it plays those exact commands back in the same order, causing Excel to behave just as if you had entered the commands yourself.&lt;br /&gt;&lt;br /&gt;Certain precautions while recording a macro will help you generate a code which will run every time you are using that macro.&lt;br /&gt;&lt;br /&gt;One major issue when you download data from source system for further processing is the sheet name. It is different every time you download data. Since the macro recorded by you will record the sheet name as available at the time of recording of macro. Same macro will not work next time as the sheet name for downloaded data will be different.&lt;br /&gt;&lt;br /&gt;To make it work you need to change the sheet name to generic name as first step while recording your macro.&lt;br /&gt;&lt;br /&gt;See the code below which is recorded to change the sheet name as first step. This helps to record the same name in macro in the next step when you flip through the sheets.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub ChangesheetName()&lt;br /&gt;    Sheets("Sheet1").Name = "Data"&lt;br /&gt;    Sheets("Data").Select&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:0;"&gt;&lt;span style="font-size:100%;"&gt;Once you have recorded above macro, small tweaking will help you to run this macro every time irrespective of the sheet name in downloaded data. You need to go to Visual Basic Editor and change the recorded macro as under&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A small change in the first line of the code will help you run the macro without worrying about the sheet name of downloaded data.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub ChangesheetName()&lt;br /&gt;    ActiveSheet.Name = "Data"&lt;br /&gt;    Sheets("Data").Select&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2327097879515891960?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2327097879515891960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/excel-macro-making-your-macro-run-every.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2327097879515891960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2327097879515891960'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/excel-macro-making-your-macro-run-every.html' title='Macros in Excel : Making your macro run every time'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5878912011740930616</id><published>2009-03-02T19:28:00.012+05:30</published><updated>2009-03-22T18:49:55.459+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Recording Excel Macro / Writing Excel Macro (VBA)</title><content type='html'>&lt;div&gt;A macro records your mouse clicks and keystrokes while you work and lets you play them back later. You can use a macro to record the sequence of commands you use to perform a certain task. When you run the macro, it plays those exact commands back in the same order, causing Excel to behave just as if you had entered the commands yourself.&lt;br /&gt;&lt;br /&gt;If you are recording macros for the first time make you "Visual Basic" toolbar visible as it comes handy for recording.&lt;br /&gt;&lt;br /&gt;You need to go to "View -&gt; Toolbars -&gt; Visual basic" Once you have made it visible it will look like as seen in picture below:-&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/Savo4bxyY1I/AAAAAAAAADk/WgJowsV7n9A/s1600-h/Visual+Basic+toolbar.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308592642013160274" style="WIDTH: 228px; CURSOR: hand; HEIGHT: 27px" alt="" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/Savo4bxyY1I/AAAAAAAAADk/WgJowsV7n9A/s400/Visual+Basic+toolbar.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Once you have this visible you are ready to record a excel macro.&lt;br /&gt;Click on &lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/SavpwKtqn4I/AAAAAAAAADs/kBaKJmp_3Do/s1600-h/record+macro.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308593599505145730" style="WIDTH: 23px; CURSOR: hand; HEIGHT: 27px" alt="" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/SavpwKtqn4I/AAAAAAAAADs/kBaKJmp_3Do/s400/record+macro.jpg" border="0" /&gt;&lt;/a&gt; to start recording.&lt;br /&gt;Once you have clicked , system will prompt with Record Macro dialog box as seen below.&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SavrMlia7QI/AAAAAAAAAD0/O9S9N7oOwHM/s1600-h/record+macro+Dailog.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308595187253701890" style="WIDTH: 296px; CURSOR: hand; HEIGHT: 210px" alt="" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SavrMlia7QI/AAAAAAAAAD0/O9S9N7oOwHM/s400/record+macro+Dailog.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here the available fields can be changed by user. Macro Name can be any combination of key strokes of your choice. Keep the name you can relate it for job you want your macro to do. Once you click OK button, system is ready to start recording you actions and following toolbar appears on your screen to stop macro recording&lt;br /&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SavtGrG9-OI/AAAAAAAAAD8/60Mq3_EeXbs/s1600-h/macro+stop+recording.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308597284693211362" style="WIDTH: 67px; CURSOR: hand; HEIGHT: 47px" alt="" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SavtGrG9-OI/AAAAAAAAAD8/60Mq3_EeXbs/s400/macro+stop+recording.jpg" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;Now you perform the task you want you macro to repeat,&lt;br /&gt;Before you record or write a macro, plan the steps and commands you want the macro to perform. If you make a mistake when you record the macro, corrections you make are also recorded. When you record macros, Visual Basic stores each macro in a new module attached to a workbook.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Once you are through with all the steps , you need to stop recording by clicking on &lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SavuQERY1-I/AAAAAAAAAEE/gyeouVlvxxM/s1600-h/macro+stop+recording+botton.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5308598545578252258" style="WIDTH: 29px; CURSOR: hand; HEIGHT: 29px" alt="" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SavuQERY1-I/AAAAAAAAAEE/gyeouVlvxxM/s400/macro+stop+recording+botton.jpg" border="0" /&gt;&lt;/a&gt; . Now your macro has been created by Excel using a programming language called Visual Basic® for Applications (VBA) to record your instructions. You don't have to know anything about programming or VBA to create and use macros.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5878912011740930616?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5878912011740930616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5878912011740930616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5878912011740930616'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html' title='Recording Excel Macro / Writing Excel Macro (VBA)'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3QrPv-CwOcc/Savo4bxyY1I/AAAAAAAAADk/WgJowsV7n9A/s72-c/Visual+Basic+toolbar.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2351357489408279734</id><published>2009-03-01T10:22:00.006+05:30</published><updated>2009-11-01T12:36:07.353+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Automating Tasks in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Macros'/><category scheme='http://www.blogger.com/atom/ns#' term='Macros in Excel'/><title type='text'>Automating tasks in Excel : Using Macros in excel</title><content type='html'>If you are doing a task again a again in excel you can automate it with a Marco. If you receive a data every day/Week/Month that you analyse the same way every time, you can create series of commands in shape of excel macro and do that task by single command of running that macro and completing your task by single click of mouse.&lt;br /&gt;&lt;br /&gt;A macro records your mouse clicks and keystrokes while you work and lets you play them back later. You can use a macro to record the sequence of commands you use to perform a certain task. When you run the macro, it plays those exact commands back in the same order, causing Excel to behave just as if you had entered the commands yourself.&lt;br /&gt;&lt;br /&gt;Macros are easy to create: you tell Excel to start recording, perform actions as you normally do, and then tell Excel when you're done. Behind the scenes, Excel uses a programming language called Visual Basic® for Applications (VBA) to record your instructions. You don't have to know anything about programming or VBA to create and use macros that will save you time and make your work easier&lt;br /&gt;&lt;br /&gt;Refer to &lt;a href="http://www.yogeshguptaonline.com/2009/03/recording-excel-macro-writing-excel.html"target="_blank"&gt;Recording Excel Macro / Writing Excel Macro&lt;/a&gt; for further details on Macros in Excel&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2351357489408279734?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2351357489408279734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/automating-tasks-in-excel-using-macros.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2351357489408279734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2351357489408279734'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/03/automating-tasks-in-excel-using-macros.html' title='Automating tasks in Excel : Using Macros in excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2178118238052052845</id><published>2009-02-15T18:52:00.009+05:30</published><updated>2009-02-15T19:47:30.571+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Custom Formating - Excel Date Format</title><content type='html'>Microsoft Excel stores dates as sequential numbers known as serial values. Excel stores times as decimal fractions because time is considered a portion of a day.&lt;br /&gt;&lt;br /&gt;You can view them as you want based on how do you format the cells. There are predefined date formats available when you choose format cells option. However you can use custom format option to display dates if available formats does not serve your requirement.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/SZgaFQsjq5I/AAAAAAAAADM/2MXiQaSaTxA/s1600-h/Custom+date+format.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5303017238912281490" style="WIDTH: 398px; CURSOR: hand; HEIGHT: 378px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/SZgaFQsjq5I/AAAAAAAAADM/2MXiQaSaTxA/s400/Custom+date+format.jpg" border="0" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;You can choose following codes or combination of it to view date in excel as you want. I have used highlighted codes dd mm yyyy with "/" to show today's date as 16/02/2009 in above screen. You can use any of these code singly or jointly with any character in between.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/SZgdT11G5kI/AAAAAAAAADc/AAKsNehE9lg/s1600-h/Custom+date+format2.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5303020787933308482" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 300px" alt="" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/SZgdT11G5kI/AAAAAAAAADc/AAKsNehE9lg/s400/Custom+date+format2.jpg" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2178118238052052845?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2178118238052052845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/02/custom-formating-date-format.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2178118238052052845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2178118238052052845'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/02/custom-formating-date-format.html' title='Custom Formating - Excel Date Format'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/SZgaFQsjq5I/AAAAAAAAADM/2MXiQaSaTxA/s72-c/Custom+date+format.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-5650542186993599001</id><published>2009-01-30T20:33:00.012+05:30</published><updated>2009-02-04T21:10:14.406+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel Vlookup Function'/><category scheme='http://www.blogger.com/atom/ns#' term='Excel Formulas'/><title type='text'>Excel Vlookup function - Entering column number</title><content type='html'>Many users find it difficult to count and enter column number in Excel vlookup formula. This looks more difficult when the number of columns in the data range are large and gets complecated in case some of columns are hidden. However Microsoft Excel has inbuilt feature by which it helps you to know the column number. At the time of selecting table array it shows you the number of columns selected. If you notice this at the time of selection, you actualy do not need to count the number of columns. This works even if you have hidden columns in your data. Pls see video for further explanation.&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/lVwE5LEdbSE&amp;amp;hl=" width="445" height="364" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" ap="%2526fmt%3D18" border="1" fs="1&amp;amp;rel="&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-5650542186993599001?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/5650542186993599001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/excel-vlookup-function-entering-column.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5650542186993599001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/5650542186993599001'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/excel-vlookup-function-entering-column.html' title='Excel Vlookup function - Entering column number'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3845704753014807123</id><published>2009-01-24T19:09:00.009+05:30</published><updated>2009-01-30T20:24:27.377+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Entering last day of the month in Excel</title><content type='html'>&lt;span style="font-family:arial;"&gt;Entering a specific date in excel is easy as you know what to enter, however if you are asked to enter last date of the month it becomes little tricky as last date of the month varies between 28 to 31 depending on what year and month it is. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;However Excel date mathematics makes it easy. What you need to do is enter the first day of next month and then reduce it by 1, you will get last day of previous month.&lt;br /&gt;&lt;br /&gt;Look at following picture to understand it better.&lt;/span&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_3QrPv-CwOcc/SXscgDO29II/AAAAAAAAACQ/ATALosLXE1g/s1600-h/last+day+of+the+month.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5294857123853169794" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 196px" alt="" src="http://4.bp.blogspot.com/_3QrPv-CwOcc/SXscgDO29II/AAAAAAAAACQ/ATALosLXE1g/s400/last+day+of+the+month.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;I have used date function to enter Feb 1, 2009 and then reduced the day by 1, other wise you can enter =Date(2009,2,0) also to get same result. after you have added above formula in Cell B4 you can use this formula to enter last day of next months in cell B5 =DATE(YEAR(B4),MONTH(B4)+2,0). You can further copy this down to get next month.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SXseaK1o3OI/AAAAAAAAACY/MvPsdu2XCvA/s1600-h/last+day+of+the+month1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5294859221838912738" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 202px" alt="" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SXseaK1o3OI/AAAAAAAAACY/MvPsdu2XCvA/s400/last+day+of+the+month1.jpg" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3845704753014807123?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3845704753014807123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/entering-last-day-of-month-in-excel.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3845704753014807123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3845704753014807123'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/entering-last-day-of-month-in-excel.html' title='Entering last day of the month in Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_3QrPv-CwOcc/SXscgDO29II/AAAAAAAAACQ/ATALosLXE1g/s72-c/last+day+of+the+month.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-8001801868186413108</id><published>2009-01-20T20:45:00.006+05:30</published><updated>2009-01-20T21:32:25.209+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Formating Cells in Excel'/><title type='text'>Formating cells in Excel</title><content type='html'>&lt;span style="font-family:arial;"&gt;Data entered in excel shows differently on your worksheet depending upon the cell format used by you. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;January 19, 2009 which is stored by system as 39832 can shown as 19-01-2009 or 19-Jan-2009 or &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;19-Jan-09. There are many combination that can be achieved by changing the cell format for the cell containing that value. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Similarly you can add currency sign such as Rs / $ / £ / ¥ , it can be any sign of your choice.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;Not only this you can actually add color codes the numbers depending upon the value.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;You can choose all these options from Format Cell Menu. You need to choose Number tab than category as per requirement of the format.&lt;/span&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/SXXzoH-7mOI/AAAAAAAAACI/xig9jJbJFOM/s1600-h/Cell+Formating.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5293404807707203810" style="WIDTH: 396px; CURSOR: hand; HEIGHT: 377px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/SXXzoH-7mOI/AAAAAAAAACI/xig9jJbJFOM/s400/Cell+Formating.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;Most tricky / dynamic category is Custom format at the end of the list. How to use this in more productive way will be covered in later posts on the specific subjects like custom formating dates, custom formating numbers etc in excel.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-8001801868186413108?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/8001801868186413108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/formating-cells-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8001801868186413108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/8001801868186413108'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/formating-cells-in-excel.html' title='Formating cells in Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/SXXzoH-7mOI/AAAAAAAAACI/xig9jJbJFOM/s72-c/Cell+Formating.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-6492935916490731019</id><published>2009-01-04T17:16:00.007+05:30</published><updated>2009-09-15T11:01:43.040+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>Excel date mathematics</title><content type='html'>&lt;span style="font-family:arial;"&gt;Microsoft Excel stores dates as sequential numbers known as serial values. Excel stores times as decimal fractions because time is considered a portion of a day.&lt;br /&gt;&lt;br /&gt;Dates and times are values and, therefore, can be added, subtracted, and included in other calculations. Will tell you date mathematics formula. &lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;How to Add / Subtract month from a date in Excel.&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Adding / Subtracting a month from a particular date in excel looks tough as each month has different number of days. However it is very simple if you use following formula. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;=DATE(YEAR(C4),MONTH(C4)+1,DAY(C4))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In this base date is available at cell C4 and we have added 1 to month value to increase it by one month. Similarly you can subtract required number of months from base date. See picture below for further understanding of it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/SW1Qcwj4ITI/AAAAAAAAAB4/nkzpMeKjzMg/s1600-h/date-maths.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5290973592232141106" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 216px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/SW1Qcwj4ITI/AAAAAAAAAB4/nkzpMeKjzMg/s400/date-maths.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Addition of more than 12 months will result into addition of year. See picture below:-&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_3QrPv-CwOcc/SW1Ux-nmKiI/AAAAAAAAACA/HOwTEsldL2I/s1600-h/date-maths1.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5290978354829601314" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 201px" alt="" src="http://1.bp.blogspot.com/_3QrPv-CwOcc/SW1Ux-nmKiI/AAAAAAAAACA/HOwTEsldL2I/s400/date-maths1.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Addition of 15 months have resulted into increase of one year and 3 months.&lt;br /&gt;&lt;br /&gt;This will work for Year addition / subtraction also.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Date Add , Date Function , excel date mathematics , Excel Date math , using date , excel date calculate , excel date calculation , excel date function , excel date functions &lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-6492935916490731019?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/6492935916490731019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/excel-date-mathematics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6492935916490731019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/6492935916490731019'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/excel-date-mathematics.html' title='Excel date mathematics'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/SW1Qcwj4ITI/AAAAAAAAAB4/nkzpMeKjzMg/s72-c/date-maths.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-251494252082012811</id><published>2009-01-04T09:46:00.007+05:30</published><updated>2009-09-13T22:21:33.349+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with date function'/><title type='text'>How Microsoft Excel stores dates and times</title><content type='html'>Microsoft Excel stores dates as sequential numbers known as serial values. Excel stores times as decimal fractions because time is considered a portion of a day.&lt;br /&gt;&lt;br /&gt;Dates and times are values and, therefore, can be added, subtracted, and included in other calculations. For example, to determine the difference between two dates, you can subtract one date from the other. You can view a date as a serial value and a time as a decimal fraction by changing the format of the cell that contains the date or time to General format.&lt;br /&gt;&lt;br /&gt;A day equals 1, half a day is .5 and an hour time interval is therefore 1/24=0.041666667&lt;br /&gt;&lt;br /&gt;Dates entered without a specified year are assumed to be in the current year&lt;br /&gt;&lt;br /&gt;Dates entered with a 2 digit year are stored as pre-2000 dates if the year is between 30 and 99 or as post-2000 dates if the year is between 0 and 29.&lt;br /&gt;&lt;br /&gt;Excel supports two date systems: the 1900 and 1904 date systems. The default date system for Microsoft Excel for Windows is 1900 and Microsoft Excel for the Macintosh uses 1904 date system.&lt;br /&gt;&lt;br /&gt;Two different date systems got created as 1900 is not a leap year and design of early Macintosh computers did not support dates before Jan 1, 1904. 1900, although divisible by 4, wasn’t a leap year. By using 1904 as a base, they saved a few bytes code, and every byte counted when they tried to squeeze the entire MacOS into 64KiB of ROM…&lt;br /&gt;&lt;br /&gt;The following table shows the first date and the last date for each date system and the serial value associated with each date.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_3QrPv-CwOcc/SWBHn03wpkI/AAAAAAAAABI/_SqCV23MVqg/s1600-h/Date.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5287304712065951298" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 71px" alt="" src="http://2.bp.blogspot.com/_3QrPv-CwOcc/SWBHn03wpkI/AAAAAAAAABI/_SqCV23MVqg/s400/Date.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To change to the 1904 date system, click Options on the Tools menu, click the Calculation tab, and then select the 1904 date system check box. This setting is workbook specific, you can have two workbooks on the same system with 1900 and 1904 date system.&lt;br /&gt;&lt;br /&gt;Be careful while changing the date system. The workbooks with actual dates recorded will also shift by 1462 days.&lt;br /&gt;&lt;br /&gt;Similarly you may get into trouble when linking two workbooks set with two different date systems. in case you get struck with such situation you can correct this by adding or subtracting 1462 from one of the workbook as the case may be.&lt;br /&gt;&lt;br /&gt;Suppose Book1 works on 1900 date system and book2 works on 1904 date system. If you are linking dates from 1904 to 1900 date system workbook, you will add 1462 to all the dates linked from 1904 date system. In a reverse scenario you will subtract 1462.&lt;br /&gt;&lt;br /&gt;&lt;H2&gt;Dates in Excel , Excel Dates, Excel Date&lt;/H2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-251494252082012811?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/251494252082012811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/how-microsoft-excel-stores-dates-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/251494252082012811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/251494252082012811'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2009/01/how-microsoft-excel-stores-dates-and.html' title='How Microsoft Excel stores dates and times'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3QrPv-CwOcc/SWBHn03wpkI/AAAAAAAAABI/_SqCV23MVqg/s72-c/Date.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-3953018811724257569</id><published>2008-12-29T05:55:00.002+05:30</published><updated>2009-01-21T21:17:22.264+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with Data Range'/><title type='text'>Defining dynamic ranges / range names in Excel</title><content type='html'>Many time we use a range in our working which keeps on changing with addition/deletion of data. Common problem here is that user needs to keep &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;refreshing&lt;/span&gt; / redefining the range.&lt;br /&gt;&lt;br /&gt;However we can use dynamic range / range names and do away with redefining problem for ever. This is done with the help of OFFSET function of excel.&lt;br /&gt;&lt;br /&gt;Offset returns a reference to a range that is a specified number of rows and columns from a cell or range of cells. The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and the number of columns to be returned.&lt;br /&gt;See the picture on defining dynamic date range name.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3QrPv-CwOcc/SVpFXCha9JI/AAAAAAAAAAU/UGUBSH79ovM/s1600-h/untitled2.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5285613374789055634" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 210px" alt="" src="http://3.bp.blogspot.com/_3QrPv-CwOcc/SVpFXCha9JI/AAAAAAAAAAU/UGUBSH79ovM/s400/untitled2.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Formula used is =OFFSET(Sheet1!$B$3,0,0,&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;COUNTA&lt;/span&gt;(Sheet1!$B:$B),4)&lt;br /&gt;&lt;br /&gt;See video for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;further&lt;/span&gt; explanation&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/bPweZdEUeLI&amp;amp;hl=en&amp;amp;fs=1&amp;amp;ap=%2526fmt%3D18 " width="440" height="305" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Where all excel offset function can be used&lt;br /&gt;&lt;/strong&gt;You can use excel offset function wherever you use range in your formula. Such as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Vlookup&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Hlookup&lt;/span&gt;, Sum, Min, Max, Pivot tables etc.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Syntax&lt;br /&gt;&lt;/strong&gt;OFFSET(reference,rows,cols,height,width)&lt;br /&gt;Reference is the reference from which you want to base the offset. Reference must be a reference to a cell or range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value&lt;br /&gt;&lt;br /&gt;Rows is the number of rows, up or down, that you want the upper-left cell to refer to. Using 5 as the rows argument specifies that the upper-left cell in the reference is five rows below reference. Rows can be positive (which means below the starting reference) or negative (which means above the starting reference).&lt;br /&gt;&lt;br /&gt;Cols is the number of columns, to the left or right, that you want the upper-left cell of the result to refer to. Using 5 as the cols argument specifies that the upper-left cell in the reference is five columns to the right of reference. Cols can be positive (which means to the right of the starting reference) or negative (which means to the left of the starting reference).&lt;br /&gt;&lt;br /&gt;If rows and cols offset reference over the edge of the worksheet, OFFSET returns the #REF! error value.&lt;br /&gt;&lt;br /&gt;Height is the height, in number of rows, that you want the returned reference to be. Height must be a positive number.&lt;br /&gt;&lt;br /&gt;Width is the width, in number of columns, that you want the returned reference to be. Width must be a positive number.&lt;br /&gt;&lt;br /&gt;If height or width is omitted, it is assumed to be the same height or width as reference.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-3953018811724257569?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/3953018811724257569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2008/12/defining-dynamic-ranges-range-names.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3953018811724257569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/3953018811724257569'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2008/12/defining-dynamic-ranges-range-names.html' title='Defining dynamic ranges / range names in Excel'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3QrPv-CwOcc/SVpFXCha9JI/AAAAAAAAAAU/UGUBSH79ovM/s72-c/untitled2.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2509167754737584590.post-2578774395702471731</id><published>2008-12-25T20:35:00.002+05:30</published><updated>2009-01-21T21:14:33.591+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Working with Data Range'/><title type='text'>How to fill blank cells in excel data range with cell above it</title><content type='html'>Many times we need to compile data using pivot table. However when you copy data from a pivot table we find blank cells below a row label and it is big challenge to fill all those blanks with row lables. There is very simple way to fill all blank cells.&lt;br /&gt;&lt;br /&gt;Step 1 - Select the entire range you need to fill&lt;br /&gt;&lt;br /&gt;Step - 2Edit &gt; Goto &gt; Special &gt; Blanks.&lt;br /&gt;&lt;br /&gt;Once you click OK button, excel will select the blank cells.&lt;br /&gt;&lt;br /&gt;Step -3 Enter the cell reference of immediate above cell in active cell without changing the selection. Hold control key and press enter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;See video attached.&lt;br /&gt;&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/VCZwFOGP1so&amp;amp;hl=" fs="1&amp;amp;ap=" width="440" height="305" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2509167754737584590-2578774395702471731?l=www.yogeshguptaonline.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.yogeshguptaonline.com/feeds/2578774395702471731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.yogeshguptaonline.com/2008/12/how-to-fill-blank-cells-in-excel-data.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2578774395702471731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2509167754737584590/posts/default/2578774395702471731'/><link rel='alternate' type='text/html' href='http://www.yogeshguptaonline.com/2008/12/how-to-fill-blank-cells-in-excel-data.html' title='How to fill blank cells in excel data range with cell above it'/><author><name>Yogesh Gupta</name><uri>http://www.blogger.com/profile/08246342663404873564</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_3QrPv-CwOcc/StCm3VNBEOI/AAAAAAAAAIg/4ahMTa1Ps5c/S220/Yogesh.jpg'/></author><thr:total>4</thr:total></entry></feed>
