<?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-8841484287833312061</id><updated>2011-10-05T03:32:28.307-07:00</updated><category term='VBA'/><category term='Password Breaker'/><title type='text'>One new Learning per day</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-5160762871431444156</id><published>2010-07-29T07:05:00.000-07:00</published><updated>2010-07-29T07:12:39.526-07:00</updated><title type='text'></title><content type='html'>&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-5160762871431444156?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/5160762871431444156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/07/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5160762871431444156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5160762871431444156'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/07/blog-post.html' title=''/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1404443019593002202</id><published>2010-02-11T03:24:00.000-08:00</published><updated>2010-02-11T03:33:39.636-08:00</updated><title type='text'>Freeing Unmanaged Resources</title><content type='html'>The garbage collector does not know how to free unmanaged resources (such as file handles, network connections, and database connections). When defining a class, you can use two mechanisms to automate the freeing of unmanaged resources&lt;br /&gt;&lt;br /&gt;Declaring a destructor (or finalizer) as a member of your class&lt;br /&gt;&lt;br /&gt;Implementing the System.IDisposable interface in your class&lt;br /&gt;&lt;br /&gt;Destructors&lt;br /&gt;Destructors are called before an object is destroyed by the garbage collector. When you define a destructor in C#, what is emitted into the assembly by the compiler is actually a method called Finalize().&lt;br /&gt;    class MyClass&lt;br /&gt;{&lt;br /&gt;~MyClass()&lt;br /&gt;{&lt;br /&gt;// destructor implementation&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The following example shows the C# code equivalent to the IL that the compiler would generate for the~MyClass destructor: &lt;br /&gt;&lt;br /&gt;protected override void Finalize()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;// destructor implementation&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;base.Finalize();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;C# destructors are non deterministic&lt;br /&gt;When a C++ object is destroyed, its destructor runs immediately.  Here it depends on GC. Another problem with C# destructors is that the implementation of a destructor delays the final removal of an object from memory.Objects that do not have a destructor get removed from memory in one pass of the garbage collector, but objects that have destructors require two passes to be destroyed:&lt;br /&gt;The first one calls the destructor without removing the object, and the second actually deletes the object.&lt;br /&gt;&lt;br /&gt;The IDisposable Interface&lt;br /&gt;In C#, the recommended alternative to using a destructor is using the System.IDisposable interface&lt;br /&gt;The implementation of Dispose() should explicitly free all unmanaged resources used directly by an object&lt;br /&gt;Suppose you have a class named ResourceGobbler, which relies on the use of some external resource and implements IDisposable&lt;br /&gt;        &lt;br /&gt;ResourceGobbler theInstance = new ResourceGobbler();&lt;br /&gt;&lt;br /&gt;// do your processing &lt;br /&gt;&lt;br /&gt;theInstance.Dispose();&lt;br /&gt;&lt;br /&gt;Unfortunately, this code fails to free the resources consumed by theInstance if an exception occurs during processing&lt;br /&gt;&lt;br /&gt;        ResourceGobbler theInstance = null;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;theInstance = new ResourceGobbler();&lt;br /&gt;&lt;br /&gt;// do your processing &lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;if (theInstance != null) theInstance.Dispose();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;C# offers a syntax that you can use to guarantee that Dispose() will automatically be called against an object that implements &lt;br /&gt;IDisposable when its reference goes out of scope&lt;br /&gt;    using (ResourceGobbler theInstance = new ResourceGobbler())&lt;br /&gt;{&lt;br /&gt;// do your processing &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;variable to be scoped &lt;br /&gt;when that variable goes out of scope, its Dispose() method will be called automatically, even if an exception occurs.&lt;br /&gt;&lt;br /&gt;Implementing IDisposable and a Destructor&lt;br /&gt;The execution of a destructor is enforced by the runtime but is nondeterministic and places an unacceptable overhead on the runtime because of the way garbage collection works.&lt;br /&gt;The IDisposable interface provides a mechanism that allows users of a class to control when resources are freed, but requires discipline to ensure that Dispose() is called.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;5 February 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1404443019593002202?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1404443019593002202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/02/freeing-unmanaged-resources.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1404443019593002202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1404443019593002202'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/02/freeing-unmanaged-resources.html' title='Freeing Unmanaged Resources'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1460191379172122703</id><published>2010-02-11T03:20:00.000-08:00</published><updated>2010-02-11T03:24:37.646-08:00</updated><title type='text'>Garbage Collection</title><content type='html'>The lives of the heap-based objects are not coupled to the scope of the individual stack-based variables that reference them. When the garbage collector runs, it will remove all those objects from the heap that are no longer referenced. As soon as the garbage collector has freed up all the objects it can, it compacts the heap by moving all remaining objects to form one contiguous block of memory. when the objects are moved about, all the references to those objects need to be updated with the correct new addresses, but the garbage collector handles that too. &lt;br /&gt;&lt;br /&gt;Generally, the garbage collector runs when the .NET runtime determines that a garbage collection is required. You can force the garbage collector to run at a certain point in your code by calling System.GC.Collect().The System.GC class is a .NET class that represents the garbage collector, and the Collect() method initiates a garbage collection. The GC class is intended for rare situations in which you know that it's a good time to call the garbage collector; for example, if you have just dereferenced a large number of objects in your code. However, the logic of the garbage collector does not guarantee that all unreferenced objects will be removed from the heap in a single garbage collection pass.&lt;br /&gt; &lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;4 February 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1460191379172122703?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1460191379172122703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/02/garbage-collection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1460191379172122703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1460191379172122703'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/02/garbage-collection.html' title='Garbage Collection'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-7926913563555629168</id><published>2010-02-11T03:11:00.000-08:00</published><updated>2010-02-11T03:19:51.728-08:00</updated><title type='text'>Memory Management for Reference Data Types</title><content type='html'>Although the stack gives very high performance, it is not flexible enough to be used for all variables. The requirement that the lifetimes of variables must be nested is too restrictive for many purposes. Often, you will want to use a method to allocate memory to store some data and be able to keep that data available long after that method has exited. This possibility exists whenever storage space is requested with the new operator — as is the case for all reference types. That's where the managed heap comes in.&lt;br /&gt;&lt;br /&gt;The managed heap (or heap for short) is just another area of memory from the process's available 4GB. The following code demonstrates how the heap works and how memory is allocated for reference data types:&lt;br /&gt;&lt;br /&gt;void DoWork()&lt;br /&gt;{&lt;br /&gt;Customer arabel;&lt;br /&gt;arabel = new Customer();&lt;br /&gt;Customer mrJones = new Nevermore60Customer();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This code assumes the existence of two classes, Customer and Nevermore60Customer&lt;br /&gt;&lt;br /&gt;First, you declare a Customer reference called arabel. The space for this will be allocated on the stack, but remember that this is only a reference, not an actual Customer object. The arabel reference takes up 4 bytes, enough space to hold the address at which a Customer object will be stored. (You need 4 bytes to represent a memory address as an integer value between 0 and 4GB.)&lt;br /&gt;&lt;br /&gt;The next line&lt;br /&gt;&lt;br /&gt;arabel = new Customer();&lt;br /&gt;does several things. First, it allocates memory on the heap to store a Customer object (a real object, not just an address). Then it sets the value of the variable arabel to the address of the memory it has allocated to the new Customer object. (It also calls the appropriate Customer() constructor to initialize the fields in the class instance, but we won't worry about that here.)&lt;br /&gt;&lt;br /&gt;The Customer instance is not placed on the stack — it is placed on the heap. In this example, you don't know precisely how many bytes a Customer object occupies, but assume for the sake of argument it is 32. These 32 bytes contain the instance fields of Customer as well as some information that .NET uses to identify and manage its class instances.&lt;br /&gt;&lt;br /&gt;When a reference variable goes out of scope, it is removed from the stack, but the data for a referenced object is still sitting on the heap. The data will remain on the heap until either the program terminates, or the garbage collector removes it, which will only happen when it is no longer referenced by any variables.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;3 February 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-7926913563555629168?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/7926913563555629168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/02/memory-management-for-reference-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7926913563555629168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7926913563555629168'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/02/memory-management-for-reference-data.html' title='Memory Management for Reference Data Types'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-814882369941648081</id><published>2010-02-11T03:07:00.000-08:00</published><updated>2010-02-11T03:11:28.704-08:00</updated><title type='text'>Memory Management for Value Data Types</title><content type='html'>Windows uses a system known as virtual addressing, in which the mapping from the memory address seen by your program to the actual location in hardware memory is entirely managed by Windows. The result of this is that each process on a 32-bit processor sees 4GB of available memory, irrespective of how much hardware memory you actually have in your computer (on 64-bit processors this number will be greater). This 4GB of memory contains everything that is part of the program, including the executable code, any DLLs loaded by the code, and the contents of all variables used when the program runs. This 4GB of memory is known as the virtual address space or virtual memory. For convenience in this chapter it is referred to simply as memory. &lt;br /&gt;&lt;br /&gt;Somewhere inside a process's virtual memory is an area known as the stack. The stack stores value data types that are not members of objects. In addition, when you call a method, the stack is used to hold a copy of any parameters passed to the method. To understand how the stack works, you need to understand the importance of variable scope in C#. It is always the case that if a variable a goes into scope before variable b, then b will go out of scope first. Look at this code: &lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;int a;&lt;br /&gt;// do something&lt;br /&gt;{&lt;br /&gt;int b;&lt;br /&gt;// do something else&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;First, a gets declared. Then, inside the inner code block, b gets declared. Then the inner code block terminates and b goes out of scope; then a goes out of scope. So, the lifetime of b is entirely contained within the lifetime of a. The idea that you always deallocate variables in the reverse order to how you allocate them is crucial to the way the stack works. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;2 February 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-814882369941648081?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/814882369941648081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/02/memory-management-for-value-data-types.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/814882369941648081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/814882369941648081'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/02/memory-management-for-value-data-types.html' title='Memory Management for Value Data Types'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-393191124759093784</id><published>2010-01-31T20:59:00.000-08:00</published><updated>2010-01-31T21:42:38.396-08:00</updated><title type='text'>Virtual Methods</title><content type='html'>By declaring a base class function as virtual, you allow the function to be overridden in any derived classes: &lt;br /&gt;&lt;br /&gt;class MyBaseClass&lt;br /&gt;{&lt;br /&gt;public virtual string VirtualMethod()&lt;br /&gt;{&lt;br /&gt;return "This method is virtual and defined in MyBaseClass";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;It is also permitted to declare a property as virtual. For a virtual or overridden property, the syntax is the same as for a non-virtual property, with the exception of the keyword virtual, which is added to the definition. The syntax looks like this: &lt;br /&gt;&lt;br /&gt;public virtual string ForeName&lt;br /&gt;{&lt;br /&gt;   get { return fName;}&lt;br /&gt;   set { fName = value;}&lt;br /&gt;}&lt;br /&gt;private string foreName;&lt;br /&gt;For simplicity, the following discussion focuses mainly on methods, but it applies equally well to properties. &lt;br /&gt;&lt;br /&gt;The concepts behind virtual functions in C# are identical to standard OOP concepts. You can override a virtual function in a derived class, and when the method is called, the appropriate method for the type of object is invoked. In C#, functions are not virtual by default, but (aside from constructors) can be explicitly declared as virtual. This follows the C++ methodology: for performance reasons, functions are not virtual unless indicated. In Java, by contrast, all functions are virtual. C# differs from C++ syntax, however, because it requires you to declare when a derived class's function overrides another function, using the override keyword: &lt;br /&gt;&lt;br /&gt;class MyDerivedClass : MyBaseClass&lt;br /&gt;{&lt;br /&gt;public override string VirtualMethod()&lt;br /&gt;{&lt;br /&gt;return "This method is an override defined in MyDerivedClass";&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This syntax for method overriding removes potential runtime bugs that can easily occur in C++, when a method signature in a derived class unintentionally differs slightly from the base version, resulting in the method failing to override the base version. In C# this is picked up as a compile-time error, because the compiler would see a function marked as override but no base method for it to override.&lt;br /&gt;&lt;br /&gt;Neither member fields nor static functions can be declared as virtual. The concept simply wouldn't make sense for any class member other than an instance function member.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;1 February 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-393191124759093784?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/393191124759093784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/virtual-methods.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/393191124759093784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/393191124759093784'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/virtual-methods.html' title='Virtual Methods'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2690278242893612452</id><published>2010-01-31T20:57:00.000-08:00</published><updated>2010-01-31T20:59:06.778-08:00</updated><title type='text'>Implementation Inheritance</title><content type='html'>If you want to declare that a class derives from another class, use the following syntax:&lt;br /&gt;&lt;br /&gt;class MyDerivedClass : MyBaseClass&lt;br /&gt;{&lt;br /&gt;// functions and data members here&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; Note This syntax is very similar to C++ and Java syntax. However, C++ programmers, who will be used to the concepts of public and private inheritance, should note that C# does not support private inheritance, hence the absence of a public or private qualifier on the base class name. Supporting private inheritance would have complicated the language for very little gain. In practice, private inheritance is used extremely rarely in C++ anyway.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;If a class (or a struct) also derives from interfaces, the list of base class and interfaces is separated by commas:&lt;br /&gt;&lt;br /&gt;public class MyDerivedClass : MyBaseClass, IInterface1, IInterface2&lt;br /&gt;{&lt;br /&gt;// etc.&lt;br /&gt;&lt;br /&gt;For a struct, the syntax is as follows:&lt;br /&gt;&lt;br /&gt;public struct MyDerivedStruct : IInterface1, IInterface2&lt;br /&gt;{&lt;br /&gt;// etc.&lt;br /&gt;&lt;br /&gt;If you do not specify a base class in a class definition, the C# compiler will assume that System.Object is the base class. Hence, the following two pieces of code yield the same result: &lt;br /&gt;&lt;br /&gt;class MyClass : Object  // derives from System.Object&lt;br /&gt;{&lt;br /&gt;// etc.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;class MyClass   // derives from System.Object&lt;br /&gt;{&lt;br /&gt;// etc.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;For the sake of simplicity, the second form is more common. &lt;br /&gt;&lt;br /&gt;Because C# supports the object keyword, which serves as a pseudonym for the System.Object class, you can also write: &lt;br /&gt;&lt;br /&gt;class MyClass : object   // derives from System.Object&lt;br /&gt;{&lt;br /&gt;// etc.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;If you want to reference the Object class, use the object keyword, which is recognized by intelligent editors such as Visual Studio .NET and thus facilitates editing your code.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;31 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2690278242893612452?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2690278242893612452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/implementation-inheritance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2690278242893612452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2690278242893612452'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/implementation-inheritance.html' title='Implementation Inheritance'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1326980461453316136</id><published>2010-01-29T22:20:00.000-08:00</published><updated>2010-01-29T22:23:13.371-08:00</updated><title type='text'>Type Declaration Characters</title><content type='html'>Data Type Type-Declaration Character&lt;br /&gt; &lt;br /&gt;Integer  % &lt;br /&gt; &lt;br /&gt;Long  &amp; &lt;br /&gt; &lt;br /&gt;Single  ! &lt;br /&gt; &lt;br /&gt;Double  # &lt;br /&gt; &lt;br /&gt;Currency  @ &lt;br /&gt; &lt;br /&gt;String  $ &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;30 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1326980461453316136?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1326980461453316136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/type-declaration-characters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1326980461453316136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1326980461453316136'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/type-declaration-characters.html' title='Type Declaration Characters'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-6599353094950357232</id><published>2010-01-29T22:17:00.000-08:00</published><updated>2010-01-29T22:20:37.125-08:00</updated><title type='text'>DETERMINING A DATA TYPE</title><content type='html'>You can use the VBA TypeName function to determine the data type of a variable. This example displays the data type of MyVar at each step. You see that it starts out as a string, is then converted to a double, and finally ends up as a string again.&lt;br /&gt;&lt;br /&gt;Sub VariantDemo2()&lt;br /&gt;    MyVar = "123"&lt;br /&gt;    MsgBox TypeName(MyVar)&lt;br /&gt;    MyVar = MyVar / 2&lt;br /&gt;    MsgBox TypeName(MyVar)&lt;br /&gt;    MyVar = "Answer: " &amp; MyVar&lt;br /&gt;    MsgBox TypeName(MyVar)&lt;br /&gt;    MsgBox MyVar&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Thanks to VBA, the data type conversion of undeclared variables is automatic. This process might seem like an easy way out, but remember that you sacrifice speed and memory - and you run the risk of errors that you may not even know about.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;29 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-6599353094950357232?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/6599353094950357232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/determining-data-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/6599353094950357232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/6599353094950357232'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/determining-data-type.html' title='DETERMINING A DATA TYPE'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-598186662788619554</id><published>2010-01-29T22:10:00.000-08:00</published><updated>2010-01-29T22:17:12.121-08:00</updated><title type='text'>Comments in VBA</title><content type='html'>In VBA Comments can be written in two ways:&lt;br /&gt;&lt;br /&gt;A comment can start with a single quote (')&lt;br /&gt;eg: 'this is an example&lt;br /&gt;or&lt;br /&gt;It can start with (REM)&lt;br /&gt;eg: REM this is another example&lt;br /&gt;&lt;br /&gt;REM cannot come in between the line where as ' can start anywhere in the line.&lt;br /&gt;REM is taken from BASIC Programming.&lt;br /&gt;&lt;br /&gt;Also, there is no multiline commnet in VBA. For that we need to use the comment block on the edit toolbar of VBE.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;28 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-598186662788619554?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/598186662788619554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/comments-in-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/598186662788619554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/598186662788619554'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/comments-in-vba.html' title='Comments in VBA'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1554038919991094865</id><published>2010-01-26T17:12:00.000-08:00</published><updated>2010-01-26T17:15:21.494-08:00</updated><title type='text'>PivotTable and PivotChart report specifications and limits</title><content type='html'>&lt;strong&gt;Feature&lt;/strong&gt; &lt;strong&gt;Maximum limit&lt;/strong&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;PivotTable reports&lt;/strong&gt; (PivotTable report: An interactive, crosstabulated Excel report that summarizes and analyzes data, such as database records, from various sources, including ones that are external to Excel.) on a sheet Limited by available memory &lt;br /&gt;&lt;strong&gt;Unique items per field&lt;/strong&gt; 1,048,576 &lt;br /&gt;&lt;strong&gt;Row&lt;/strong&gt; (row field: A field that's assigned a row orientation in a PivotTable report. Items associated with a row field are displayed as row labels.) &lt;strong&gt;or column fields&lt;/strong&gt; (column field: A field that's assigned a column orientation in a PivotTable report. Items associated with a column field are displayed as column labels.) &lt;strong&gt;in a PivotTable report&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Report filters in a PivotTable report&lt;/strong&gt; 256 (may be limited by available memory) &lt;br /&gt;&lt;strong&gt;Value fields in a PivotTable report&lt;/strong&gt; 256 &lt;br /&gt;&lt;strong&gt;Calculated item&lt;/strong&gt; (calculated item: An item within a PivotTable field or PivotChart field that uses a formula you create. Calculated items can perform calculations by using the contents of other items within the same field of the PivotTable report or PivotChart report.) formulas in a PivotTable report Limited by available memory &lt;br /&gt;&lt;strong&gt;Report filters in a PivotChart report &lt;/strong&gt;(PivotChart report: A chart that provides interactive analysis of data, like a PivotTable report. You can change views of data, see different levels of detail, or reorganize the chart layout by dragging fields and by showing or hiding items in fields.) 256 (may be limited by available memory) &lt;br /&gt;&lt;strong&gt;Value fields in a PivotChart report&lt;/strong&gt; 256 &lt;br /&gt;&lt;strong&gt;Calculated item formulas in a PivotChart report&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Length of the MDX name for a PivotTable item&lt;/strong&gt;  32,767 &lt;br /&gt;&lt;strong&gt;Length for a relational PivotTable string&lt;/strong&gt; 32,767 &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;27 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1554038919991094865?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1554038919991094865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/pivottable-and-pivotchart-report.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1554038919991094865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1554038919991094865'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/pivottable-and-pivotchart-report.html' title='PivotTable and PivotChart report specifications and limits'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-8112995329849345456</id><published>2010-01-26T17:09:00.000-08:00</published><updated>2010-01-26T17:11:52.798-08:00</updated><title type='text'>Charting specifications and limits</title><content type='html'>&lt;strong&gt;Feature&lt;/strong&gt; &lt;strong&gt;Maximum limit &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Charts linked to a worksheet&lt;/strong&gt; Limited by available memory  &lt;br /&gt;&lt;strong&gt;Worksheets referred to by a chart&lt;/strong&gt; 255 &lt;br /&gt;&lt;strong&gt;Data series&lt;/strong&gt; (data series: Related data points that are plotted in a chart. Each data series in a chart has a unique color or pattern and is represented in the chart legend. You can plot one or more data series in a chart. Pie charts have only one data series.) in one chart 255 &lt;br /&gt;&lt;strong&gt;Data points&lt;/strong&gt; (data points: Individual values that are plotted in a chart. Related data points make up a data series. Data points are represented by bars, columns, lines, slices, dots, and other shapes. These shapes are called data markers.) in a data series for 2-D charts 32,000 &lt;br /&gt;&lt;strong&gt;Data points in a data series for 3-D charts&lt;/strong&gt; 4,000 &lt;br /&gt;&lt;strong&gt;Data points for all data series in one chart&lt;/strong&gt; 256,000&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;26 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-8112995329849345456?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/8112995329849345456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/charting-specifications-and-limits.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8112995329849345456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8112995329849345456'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/charting-specifications-and-limits.html' title='Charting specifications and limits'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2684583199510080807</id><published>2010-01-25T03:17:00.000-08:00</published><updated>2010-01-25T03:21:20.221-08:00</updated><title type='text'>Calculation specifications and limits</title><content type='html'>&lt;strong&gt;Feature&lt;/strong&gt; &lt;strong&gt;Maximum limit&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Number precision&lt;/strong&gt; 15 digits &lt;br /&gt;&lt;strong&gt;Smallest allowed negative number&lt;/strong&gt; -2.2251E-308 &lt;br /&gt;&lt;strong&gt;Smallest allowed positive number&lt;/strong&gt; 2.2251E-308 &lt;br /&gt;&lt;strong&gt;Largest allowed positive number&lt;/strong&gt; 9.99999999999999E+307 &lt;br /&gt;&lt;strong&gt;Largest allowed negative number&lt;/strong&gt; -9.99999999999999E+307 &lt;br /&gt;&lt;strong&gt;Largest allowed positive number via formula&lt;/strong&gt; 1.7976931348623158e+308 &lt;br /&gt;&lt;strong&gt;Largest allowed negative number via formula&lt;/strong&gt; -1.7976931348623158e+308&lt;br /&gt;&lt;strong&gt;Length of formula contents&lt;/strong&gt; 8,192 characters &lt;br /&gt;&lt;strong&gt;Internal length of formula&lt;/strong&gt; 16,384 bytes &lt;br /&gt;&lt;strong&gt;Iterations&lt;/strong&gt; 32,767 &lt;br /&gt;&lt;strong&gt;Worksheet arrays&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Selected ranges&lt;/strong&gt; 2,048 &lt;br /&gt;&lt;strong&gt;Arguments in a function&lt;/strong&gt; 255 &lt;br /&gt;&lt;strong&gt;Nested levels of functions&lt;/strong&gt; 64 &lt;br /&gt;&lt;strong&gt;User defined function categories&lt;/strong&gt; 255 &lt;br /&gt;&lt;strong&gt;Number of available worksheet functions&lt;/strong&gt; 341 &lt;br /&gt;&lt;strong&gt;Size of the operand stack&lt;/strong&gt; 1,024 &lt;br /&gt;&lt;strong&gt;Cross-worksheet dependency&lt;/strong&gt; 64,000 worksheets that can refer to other sheets &lt;br /&gt;&lt;strong&gt;Cross-worksheet array formula dependency&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Area dependency&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Area dependency per worksheet&lt;/strong&gt; Limited by available memory &lt;br /&gt;&lt;strong&gt;Dependency on a single cell&lt;/strong&gt; 4 billion formulas that can depend on a single cell &lt;br /&gt;&lt;strong&gt;Linked cell content length from closed workbooks&lt;/strong&gt; 32,767 &lt;br /&gt;&lt;strong&gt;Earliest date allowed for calculation&lt;/strong&gt; January 1, 1900 (January 1, 1904, if 1904 date system is used) &lt;br /&gt;&lt;strong&gt;Latest date allowed for calculation&lt;/strong&gt; December 31, 9999 &lt;br /&gt;&lt;strong&gt;Largest amount of time that can be entered&lt;/strong&gt; 9999:59:59 &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;25 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2684583199510080807?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2684583199510080807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/calculation-specifications-and-limits.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2684583199510080807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2684583199510080807'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/calculation-specifications-and-limits.html' title='Calculation specifications and limits'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1886023653842671343</id><published>2010-01-25T03:10:00.000-08:00</published><updated>2010-01-25T03:16:48.733-08:00</updated><title type='text'>Worksheet and workbook specifications and limits</title><content type='html'>&lt;strong&gt;Feature&lt;/strong&gt; &lt;strong&gt;Maximum limit&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Open workbooks&lt;/strong&gt; Limited by available memory and system resources&lt;br /&gt;&lt;strong&gt;Worksheet size&lt;/strong&gt; 1,048,576 rows by 16,384 columns&lt;br /&gt;&lt;strong&gt;Column width&lt;/strong&gt; 255 characters&lt;br /&gt;&lt;strong&gt;Row height&lt;/strong&gt; 409 points&lt;br /&gt;&lt;strong&gt;Page breaks&lt;/strong&gt; 1,026 horizontal and vertical&lt;br /&gt;&lt;strong&gt;Total number of characters that a cell can contain&lt;/strong&gt; 32,767 characters&lt;br /&gt;&lt;strong&gt;Characters in a header or footer&lt;/strong&gt; 255&lt;br /&gt;&lt;strong&gt;Sheets in a workbook&lt;/strong&gt; Limited by available memory (default is 3 sheets)&lt;br /&gt;&lt;strong&gt;Colors in a workbook&lt;/strong&gt; 16 million colors (32 bit with full access to 24 bit color spectrum)&lt;br /&gt;&lt;strong&gt;Named views&lt;/strong&gt; (view: A set of display and print settings that you can name and apply to a workbook. You can create more than one view of the same workbook without saving separate copies of the workbook.) Limited by available memory&lt;br /&gt;&lt;strong&gt;Unique cell formats/cell styles&lt;/strong&gt; 64,000&lt;br /&gt;&lt;strong&gt;Fill styles&lt;/strong&gt; 32&lt;br /&gt;&lt;strong&gt;Line weight and styles&lt;/strong&gt; 16&lt;br /&gt;&lt;strong&gt;Unique font types&lt;/strong&gt; 1,024 global fonts available for use; 512 per workbook&lt;br /&gt;&lt;strong&gt;Number formats in a workbook&lt;/strong&gt; Between 200 and 250, depending on the language version of Excel that you have installed&lt;br /&gt;&lt;strong&gt;Names in a workbook&lt;/strong&gt; Limited by available memory&lt;br /&gt;&lt;strong&gt;Windows in a workbook&lt;/strong&gt; Limited by available memory&lt;br /&gt;&lt;strong&gt;Panes in a window&lt;/strong&gt; 4&lt;br /&gt;&lt;strong&gt;Linked sheets&lt;/strong&gt; Limited by available memory&lt;br /&gt;&lt;strong&gt;Scenarios&lt;/strong&gt; (scenario: A named set of input values that you can substitute in a worksheet model.) Limited by available memory; a summary report shows only the first 251 scenarios&lt;br /&gt;&lt;strong&gt;Changing cells in a scenario&lt;/strong&gt; 32&lt;br /&gt;&lt;strong&gt;Adjustable cells in Solver&lt;/strong&gt; 200&lt;br /&gt;&lt;strong&gt;Custom functions&lt;/strong&gt; Limited by available memory&lt;br /&gt;&lt;strong&gt;Zoom range&lt;/strong&gt; 10 percent to 400 percent&lt;br /&gt;&lt;strong&gt;Reports&lt;/strong&gt; Limited by available memory&lt;br /&gt;&lt;strong&gt;Sort references&lt;/strong&gt; 64 in a single sort; unlimited when using sequential sorts&lt;br /&gt;&lt;strong&gt;Undo levels&lt;/strong&gt; 100&lt;br /&gt;&lt;strong&gt;Fields in a data form&lt;/strong&gt; 32&lt;br /&gt;&lt;strong&gt;Workbook parameters&lt;/strong&gt; 255 parameters per workbook&lt;br /&gt;&lt;strong&gt;Filter drop-down lists&lt;/strong&gt; 10,000&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;24 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1886023653842671343?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1886023653842671343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/worksheet-and-workbook-specifications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1886023653842671343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1886023653842671343'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/worksheet-and-workbook-specifications.html' title='Worksheet and workbook specifications and limits'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4504658029952367082</id><published>2010-01-23T02:45:00.000-08:00</published><updated>2010-01-23T02:48:48.255-08:00</updated><title type='text'>Moving your cursor</title><content type='html'>Sometimes you need to move your cursor around your worksheet to re-position it before running the next step of a macro. The movement here uses the row, column position method. &lt;br /&gt;&lt;br /&gt;Sub Down()&lt;br /&gt;ActiveCell.Offset(1, 0).Select&lt;br /&gt;End Sub&lt;br /&gt;Sub up()&lt;br /&gt;ActiveCell.Offset(-1, 0).Select&lt;br /&gt;End Sub&lt;br /&gt;Sub Right()&lt;br /&gt;ActiveCell.Offset(0, 1).Select&lt;br /&gt;End Sub&lt;br /&gt;Sub Left()&lt;br /&gt;ActiveCell.Offset(0, -1).Select&lt;br /&gt;End Sub &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;23 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4504658029952367082?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4504658029952367082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/moving-your-cursor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4504658029952367082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4504658029952367082'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/moving-your-cursor.html' title='Moving your cursor'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-7099545137522566563</id><published>2010-01-22T05:45:00.000-08:00</published><updated>2010-01-22T05:47:37.695-08:00</updated><title type='text'>Modeless Forms</title><content type='html'>Sometimes you want to allow users to be able to switch between your form and your spreadsheet by clicking on either one. All you need to do is set the form property of Show Modal to False or you can try this. However this is only for Excel 2000 &amp; above. &lt;br /&gt;&lt;br /&gt;Sub myForm()&lt;br /&gt;UserForm.show vbModeless&lt;br /&gt;End Sub &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;22 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-7099545137522566563?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/7099545137522566563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/modeless-forms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7099545137522566563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7099545137522566563'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/modeless-forms.html' title='Modeless Forms'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1774123075880221504</id><published>2010-01-21T08:50:00.000-08:00</published><updated>2010-01-21T08:51:24.913-08:00</updated><title type='text'>Protecting all sheets</title><content type='html'>To protect all the sheets this macro uses all the methods contained in this page (see counting sheets). The If, Then statement is also used here. This tests for a condition and if the condition is TRUE, then the macro continuous the next line of code. In this case it will END the macro. If the condition is NOT TRUE, then it will go to the following line which in this case is to select the next sheet. You will also notice the For, Next statement is also used. This acts as a counter to tell the macro how many loops to run. In this case if there are 3 sheets, the macro will run 3 times protecting all the 3 sheets.&lt;br /&gt;&lt;br /&gt;Sub protectAll()&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;myCount = Application.Sheets.Count&lt;br /&gt;Sheets(1).Select 'This line of code selects the 1st sheet&lt;br /&gt;For i = 1 To myCount&lt;br /&gt;ActiveSheet.Protect&lt;br /&gt;If i = myCount Then&lt;br /&gt;End&lt;br /&gt;End If&lt;br /&gt;ActiveSheet.Next.Select&lt;br /&gt;Next i&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;21 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1774123075880221504?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1774123075880221504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/protecting-all-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1774123075880221504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1774123075880221504'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/protecting-all-sheets.html' title='Protecting all sheets'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-7989888688561533627</id><published>2010-01-20T09:23:00.000-08:00</published><updated>2010-01-20T09:26:46.745-08:00</updated><title type='text'>Change column order in Pivot Table</title><content type='html'>To change the column order in Pivot Table, We can right click on th ecolumn and say move right or move left. But, the easiest way to do it is to type the column names int he required positions.&lt;br /&gt;&lt;br /&gt;For example, if ODI,T20,Test is the current order, to change it to ODI,Test,T20, we need to change the column name in T20 to Test. &lt;br /&gt;&lt;br /&gt;This will automatically move the contents of the column also.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;20 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-7989888688561533627?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/7989888688561533627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/change-column-order-in-pivot-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7989888688561533627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7989888688561533627'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/change-column-order-in-pivot-table.html' title='Change column order in Pivot Table'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1605246439426408188</id><published>2010-01-20T09:20:00.000-08:00</published><updated>2010-01-20T09:23:15.442-08:00</updated><title type='text'>Fill Empty Cells in Pivot table</title><content type='html'>To fill empty cels in Pivot Table with a desired value,&lt;br /&gt;We need to go to pivot table options and choose -&gt; For Empty Cells Show:&lt;br /&gt;&lt;br /&gt;This will show all the empty cells in Pivot as the given value.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;19 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1605246439426408188?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1605246439426408188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/fill-empty-cells-in-pivot-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1605246439426408188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1605246439426408188'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/fill-empty-cells-in-pivot-table.html' title='Fill Empty Cells in Pivot table'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-8406644318781425614</id><published>2010-01-18T10:06:00.000-08:00</published><updated>2010-01-18T10:07:09.516-08:00</updated><title type='text'>Saving a file</title><content type='html'>There are times you may want a macro to save a file automatically after running a macro. The second macro will save the file with a name called "MyFile". You may specify the path if you need to. &lt;br /&gt;&lt;br /&gt;Sub Save()&lt;br /&gt;ActiveWorkbook.Save&lt;br /&gt;End Sub&lt;br /&gt;Sub SaveName()&lt;br /&gt;ActiveWorkbook.SaveAs Filename:="C:\MyFile.xls"&lt;br /&gt;End Sub &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;18 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-8406644318781425614?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/8406644318781425614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/saving-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8406644318781425614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8406644318781425614'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/saving-file.html' title='Saving a file'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4293244748035448472</id><published>2010-01-16T21:03:00.000-08:00</published><updated>2010-01-16T22:51:08.757-08:00</updated><title type='text'>Add Worksheets to Excel</title><content type='html'>Adding worksheets to Excel is very simple. For example, to add a Worksheet after the active sheet (default unless stated otherwise), name it "MySheet" and have it become the active sheet, you would use some code like shown below;&lt;br /&gt;&lt;br /&gt;Sub AddWorksheet()&lt;br /&gt;Worksheets.Add().Name = "MySheet"&lt;br /&gt;End SubIf &lt;br /&gt;&lt;br /&gt;we wanted to add a Worksheet as the last Worksheet and name it "MySheet" we would use;&lt;br /&gt;&lt;br /&gt;Sub AddAsLastWorksheet()&lt;br /&gt;Worksheets.Add (After:=Worksheets(Worksheets.Count)).Name = "MySheet"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;The Add Method as it applies to the Worksheet Object also has a Before Variant as well as an After Variant. However, we can only nominate a Before or After Variant, or omit the Argument altogether. If we do omit the Before and After Variants Excel places the Worksheet after the current active Sheet.&lt;br /&gt;&lt;br /&gt;To add, say, 4 Worksheets we could use the Count Variant;&lt;br /&gt;&lt;br /&gt;Sub AddXWorksheets()&lt;br /&gt;Worksheets.Add After:=Worksheets(Worksheets.Count), Count:=4&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;The only other Variant we can use if desired is the Type Variant. The Type specifies the sheet type. Can be one of the following XlSheetType constants: xlWorksheet, xlChart, xlExcel4MacroSheet, or xlExcel4IntlMacroSheet. If you are inserting a sheet based on an existing template, specify the path to the template (Recording a macro is best for this). The default value is xlWorksheet&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;17 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4293244748035448472?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4293244748035448472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/add-worksheets-to-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4293244748035448472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4293244748035448472'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/add-worksheets-to-excel.html' title='Add Worksheets to Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4093547280815615829</id><published>2010-01-16T20:56:00.000-08:00</published><updated>2010-01-16T21:00:36.239-08:00</updated><title type='text'>AutoFilter Criteria in Excel VBA</title><content type='html'>Ok, last page we looked at how we can set AutoFilters up within an Excel Workbook. In summary, rather than check if AutoFilters are already applied to a specified Worksheet with an IF Statement, then, if they were on and in use (filtered down) we would turn them off and apply to the needed range. If they weren't on then simply apply them to the needed range.&lt;br /&gt;&lt;br /&gt;This however was a lot of superfluous code. The easiest and best way is as shown below;&lt;br /&gt;&lt;br /&gt;Sub ApplyAutoFilters()   With ActiveSheet           .AutoFilterMode = False           .Range("A1:D1").AutoFilter   End With  End SubIn the code above we turn off any existing AutoFilters and apply them to the range A1:D1 of the active worksheet.&lt;br /&gt;&lt;br /&gt;FILTERING DOWN TO SHOW 1 MATCHING CRITERIA&lt;br /&gt;&lt;br /&gt;Let's now look at how we can apply AutoFilters and show only matching criteria. In the examples below I have used a specified Worksheet by referencing its CodeName . It is also based on the data being in the range A1:D100 with A1:D1 being headings:&lt;br /&gt;&lt;br /&gt;Name | Age | Date Joined | Department&lt;br /&gt;&lt;br /&gt;Sub FilterTo1Criteria()   With Sheet1           .AutoFilterMode = False           .Range("A1:D1").AutoFilter           .Range("A1:D1").AutoFilter Field:=2, Criteria1:=35   End With  End SubIn the example below we have filtered our table down to match 1 criteria (Criteria1) on our second heading (Age) to show only those who are 35. If we were to show all those that are 35 or older our Criteria1 would need to be like;&lt;br /&gt;&lt;br /&gt;Criteria1:="&gt;=35"&lt;br /&gt;&lt;br /&gt;In other words, the criteria and any operators should be passed as text with an equal sign preceding the string.&lt;br /&gt;&lt;br /&gt;We can have the filter show only blanks for the specified Field by using: Criteria1:="="&lt;br /&gt;&lt;br /&gt;To show all non-blanks we would use: Criteria1:="&lt;&gt;"&lt;br /&gt;&lt;br /&gt;XlAutoFilterOperator can be one of these constants&lt;br /&gt;&lt;br /&gt;xlAnd default&lt;br /&gt;xlBottom10Items&lt;br /&gt;xlBottom10Percent&lt;br /&gt;xlOr&lt;br /&gt;xlTop10Items&lt;br /&gt;xlTop10Percent&lt;br /&gt;&lt;br /&gt;If we wanted to show only those in the Name field whose name Start s with a "D" we would use: Criteria1:="=D*"&lt;br /&gt;To show all names that do not contain a letter "a" we would use: Criteria1:="&lt;&gt;*a*"&lt;br /&gt;&lt;br /&gt;In short, the best way to obtain your needed criteria is to simply record a macro filtering your table down and then copy the Criteria1: and the optional Criteria2: code generated.&lt;br /&gt;&lt;br /&gt;If desired, for whatever reason, we can have Excel hide the Filter arrow for Field2 (or any Field) by using an additional&lt;br /&gt;argument after Criteria1. That is: ,VisibleDropDown:=False&lt;br /&gt;&lt;br /&gt;FILTERING DOWN TO SHOW 2 MATCHING CRITERIA&lt;br /&gt;&lt;br /&gt;Let's now expand on the above by filtering down to show 2 criteria.&lt;br /&gt;&lt;br /&gt;Sub FilterTo2Criteria()   With Sheet1           .AutoFilterMode = False           .Range("A1:D1").AutoFilter           .Range("A1:D1").AutoFilter Field:=2, Criteria1:="&gt;=35", _            Operator:=xlAnd, Criteria2:="&lt;=45"   End With  End SubIn the above code we have chosen to show all whose age is between 35 and 45. It's important to note that for the Operator argument we have used xlAnd. If we had used the other choice (XlOr) our results would be that of our original table. That is, all records would show as all people would be either &gt;=35 or &lt;=45.&lt;br /&gt;&lt;br /&gt;Sub FilterTo2Fields()   With Sheet1           .AutoFilterMode = False               With .Range("A1:D1")                    .AutoFilter                    .AutoFilter Field:=1, Criteria1:="Dave"                    .AutoFilter Field:=4, Criteria1:="Lab"               End With   End With   End SubIn the code above we have shown all those with the name "Dave" whose department is "Lab". As you can see from the above code,&lt;br /&gt;We can add more fields, but cannot exceed our total column count of headings. In this case we could use Field 1, 2, 3 and/or 4.&lt;br /&gt;&lt;br /&gt;FILTERING DOWN TO SHOW WILDCARDS&lt;br /&gt;&lt;br /&gt;The wildcard characters we can use in AutoFilter are the asterisk (*) to represent a string of characters and/or the question mark (?) to represent a single character.&lt;br /&gt;&lt;br /&gt;However, what if we need to show data that actually houses the * or ? By the way, if at all possible these characters should not be used on their own. &lt;br /&gt;&lt;br /&gt;Sub FilterToShowAsterisk()   With Sheet1           .AutoFilterMode = False           .Range("A1:D1").AutoFilter           .Range("A1:D1").AutoFilter Field:=1, Criteria1:="~*"   End With  End SubAs you can see from the above code, we have told Excel we actually want to filter by the asterisk and not have it seen as a wildcard. The same applies for the question mark. That is: Criteria1:="~?"&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;16 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4093547280815615829?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4093547280815615829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/autofilter-criteria-in-excel-vba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4093547280815615829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4093547280815615829'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/autofilter-criteria-in-excel-vba.html' title='AutoFilter Criteria in Excel VBA'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4312805014191462814</id><published>2010-01-14T21:42:00.000-08:00</published><updated>2010-01-16T21:01:35.401-08:00</updated><title type='text'>VBA &amp; AutoFilters</title><content type='html'>AutoFilter provides us with a MUCH faster alternative to loops of all kinds. &lt;br /&gt;In the majority of cases it's faster and more efficient to use one of Excel's built in features as apposed to re-inventing the wheel with VBA code. This is why those that have learnt Excel from the ground-up know what native features Excel has to offer. While those only familiar with VB/VBA tend to be the ones who re-invent the wheel.&lt;br /&gt;&lt;br /&gt;Ok, the first thing we need to know is how to apply AutoFilter to a range. When we do apply AutoFilter via VBA one SHOULD always turn the off any current filters and remove them completely. Why not check if the AutoFilter is already in place and go from there? The answer is simple, while we can determine if AutoFilter has/is on a specific Worksheet, we cannot guarantee (with extra checking) that it is in use on the range we need! For example, we could use the code below to check.&lt;br /&gt;&lt;br /&gt;Sub CheckForAutoFilters()&lt;br /&gt;If ActiveSheet.AutoFilterMode = True Then      &lt;br /&gt;MsgBox "They are visible"&lt;br /&gt;Else      &lt;br /&gt;MsgBox "They are not visible"&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;From the code above we will know if AutoFilters are visible, but not necessarily in Filter mode (more on that soon). However, we cannot tell if the AutoFilterMode is applied to the correct range. Let's now see how we can determine if the AutoFilters and in use and are being used to filter down. &lt;br /&gt;&lt;br /&gt;Sub CheckForAutoFilters2()&lt;br /&gt;With ActiveSheet  &lt;br /&gt;If .AutoFilterMode = True And .FilterMode = True Then   &lt;br /&gt;MsgBox "They are visible and in use"  &lt;br /&gt;ElseIf .AutoFilterMode = True Then   &lt;br /&gt;MsgBox "They are visible but not in use"  &lt;br /&gt;Else   MsgBox "They are not visible or in use"  &lt;br /&gt;End If&lt;br /&gt;End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;As you can see, we have used the FilterMode Property of the Worksheet to determine whether the AutoFilters are filtering data down. So, in summary, AutoFilterMode tells us if the AutoFilter arrows are visible and FilterMode tells us if they are in use. However, as I mentioned above this does not tell us which range has had AutoFilter applied. So, with this in mind, we are better off simply removing any existing Autofilter and then applying them to our required range. Here is how, assuming we want A1:D1 to have the AutoFilters. &lt;br /&gt;&lt;br /&gt;Sub ApplyAutoFilters() &lt;br /&gt;With ActiveSheet  &lt;br /&gt;.AutoFilterMode = False  &lt;br /&gt;.Range("A1:D1").AutoFilter &lt;br /&gt;End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Another advantage to applying AutoFilter is this manner is that no error occurs if AutoFilterMode is already false. By the way, we cannot use: AutoFilterMode = True to apply AutoFilters. To apply AutoFilter (at this time with no criteria) we would use Range("A1:D1").AutoFilter. If we are to first check the range that AutoFilter is applied to, we would use code like below;&lt;br /&gt;&lt;br /&gt;Sub IsAutoFiltersOnRightRange()&lt;br /&gt;With ActiveSheet  If .AutoFilterMode = True Then   &lt;br /&gt;MsgBox .AutoFilter.Range.Address  &lt;br /&gt;Else   MsgBox "AutoFilters are not on"  &lt;br /&gt;End If &lt;br /&gt;End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;In my mind though, this code is superfluous when compared with simply removing and applying AutoFilters. Let's now look at how we apply AutoFilter to a SINGLE cell in a range. If we had our table in the range A1:D200 on the Active sheet and we used the "ApplyAutoFilters" Procedure with .Range("A1").AutoFilter we would likely end up with AutoFilter applied to ALL contiguous headings across row 1. This due to the fact that Excel will detect the contiguous headings across row 1 and assume that we want all headings to have AutoFilters. We can force Excel to not do this by specifying a 2 row single column range. For example; &lt;br /&gt;&lt;br /&gt;Sub ApplyAutoFiltersToOneCell() &lt;br /&gt;With ActiveSheet  &lt;br /&gt;.AutoFilterMode = False  &lt;br /&gt;.Range("A1:A2").AutoFilter &lt;br /&gt;End With&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;15 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4312805014191462814?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4312805014191462814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/autofilter-provides-us-with-much-faster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4312805014191462814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4312805014191462814'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/autofilter-provides-us-with-much-faster.html' title='VBA &amp; AutoFilters'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-5358449246407879581</id><published>2010-01-14T03:33:00.000-08:00</published><updated>2010-01-14T03:36:34.463-08:00</updated><title type='text'>Calling a Worksheet Function from Visual Basic</title><content type='html'>In Visual Basic, the Microsoft Excel worksheet functions are available through the WorksheetFunction object.&lt;br /&gt;&lt;br /&gt;The following Sub procedure uses the Min worksheet function to determine the smallest value in a range of cells. First, the variable myRange is declared as a Range object, and then it's set to range A1:C10 on Sheet1. Another variable, answer, is assigned the result of applying the Min function to myRange. Finally, the value of answer is displayed in a message box.&lt;br /&gt;&lt;br /&gt;Sub UseFunction()&lt;br /&gt;    Dim myRange As Range&lt;br /&gt;    Set myRange = Worksheets("Sheet1").Range("A1:C10")&lt;br /&gt;    answer = Application.WorksheetFunction.Min(myRange)&lt;br /&gt;    MsgBox answer&lt;br /&gt;End Sub&lt;br /&gt;  If you use a worksheet function that requires a range reference as an argument, you must specify a Range object. For example, you can use the Match worksheet function to search a range of cells. In a worksheet cell, you would enter a formula such as =MATCH(9,A1:A10,0). However, in a Visual Basic procedure, you would specify a Range object to get the same result.&lt;br /&gt;&lt;br /&gt;Sub FindFirst()&lt;br /&gt;    myVar = Application.WorksheetFunction _&lt;br /&gt;        .Match(9, Worksheets(1).Range("A1:A10"), 0)&lt;br /&gt;    MsgBox myVar&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;14 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-5358449246407879581?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/5358449246407879581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/calling-worksheet-function-from-visual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5358449246407879581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5358449246407879581'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/calling-worksheet-function-from-visual.html' title='Calling a Worksheet Function from Visual Basic'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-8768701384708231421</id><published>2010-01-12T22:27:00.000-08:00</published><updated>2010-01-12T22:29:07.671-08:00</updated><title type='text'>Counting Rows &amp; Columns &amp; Sheets</title><content type='html'>When you have selected a range, it is sometimes useful to know how many rows or columns you have selected as this information can be used in your macros (for eg when you have reached the end, you will know it is time to stop the macros. This macro will do the trick.&lt;br /&gt;&lt;br /&gt;Sub Count()&lt;br /&gt;mycount = Selection.Rows.Count 'Change Rows to Columns to count columns&lt;br /&gt;MsgBox mycount&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;The next macro counts the number of sheets instead. Refer to Protecting all sheets macro which uses this method.&lt;br /&gt;&lt;br /&gt;Sub Count2()&lt;br /&gt;mycount = Application.Sheets.Count&lt;br /&gt;MsgBox mycount&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;13 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-8768701384708231421?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/8768701384708231421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/counting-rows-columns-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8768701384708231421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8768701384708231421'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/counting-rows-columns-sheets.html' title='Counting Rows &amp; Columns &amp; Sheets'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-8015246353656008600</id><published>2010-01-12T22:25:00.000-08:00</published><updated>2010-01-12T22:26:50.278-08:00</updated><title type='text'>Auto Run</title><content type='html'>Making your macros run automatically when opening your workbook. You can either use the Auto Open method or the Workbook Open method. These macros will display the message "Hello" when you open the workbook.&lt;br /&gt;&lt;br /&gt;Sub Auto_Open()&lt;br /&gt;Msgbox "Hello"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;This code would be located in the module. However if you use the second method, the code must be in the workbook (double click "This Workbook" in the explorer window). Click on the drop down list (that says General) and select Workbook. Click on the drop down list (that says declarations) and select Open.&lt;br /&gt;&lt;br /&gt;Private Sub Workbook_Open()&lt;br /&gt;Msgbox "Hello"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;12 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-8015246353656008600?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/8015246353656008600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/auto-run.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8015246353656008600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/8015246353656008600'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/auto-run.html' title='Auto Run'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2574006122695629084</id><published>2010-01-11T09:27:00.000-08:00</published><updated>2010-01-11T09:29:42.607-08:00</updated><title type='text'>Excel VLOOKUP and Index &amp; Match</title><content type='html'>One day, you have a situation where you have the employee name, but need the employee number. In the following image, you have a name in A10 and need to find the employee number in B10.&lt;br /&gt;&lt;br /&gt;=INDEX(data range, row number, column number)&lt;br /&gt;=MATCH(Value, Single-column data range, FALSE)&lt;br /&gt;&lt;br /&gt;=INDEX($A$2:$A$6,MATCH(A10,$B$2:$B$6,FALSE),1)&lt;br /&gt;&lt;br /&gt;This fixes the vlookup's issue of travelling to the left.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;11 December 2009.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2574006122695629084?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2574006122695629084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/excel-vlookup-and-index-match.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2574006122695629084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2574006122695629084'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/excel-vlookup-and-index-match.html' title='Excel VLOOKUP and Index &amp; Match'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-3094731355419218212</id><published>2010-01-09T21:34:00.000-08:00</published><updated>2010-01-09T21:36:23.951-08:00</updated><title type='text'>Goto a RANGE</title><content type='html'>To specify a macro to go to a specific range you can use the Goto method. Here I have already named a range in my worksheet called "Sales". You may also use an alternative method ie the Range select method. Naming a range in excel is recommended rather than specifying an absolute cell reference.&lt;br /&gt;&lt;br /&gt;Sub GoHere()&lt;br /&gt;Application.Goto Reference:="Sales" OR Range("Sales").Select&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;10 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-3094731355419218212?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/3094731355419218212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/goto-range.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3094731355419218212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3094731355419218212'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/goto-range.html' title='Goto a RANGE'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-7888324915677323594</id><published>2010-01-09T02:02:00.001-08:00</published><updated>2010-01-14T23:02:11.897-08:00</updated><title type='text'>Flickering Screen</title><content type='html'>Sometimes when you run a macro, the screen flickers a lot due to the screen updating itself. This slows the macro done especially when the macro has a lot of work to do. You need to include the statement as shown below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Application.ScreenUpdating = False&lt;br /&gt;&lt;br /&gt;You need to set the screen updating back to true at the end of the macro.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;9 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-7888324915677323594?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/7888324915677323594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/flickering-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7888324915677323594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7888324915677323594'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/flickering-screen.html' title='Flickering Screen'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-5927098480988436570</id><published>2010-01-08T00:39:00.000-08:00</published><updated>2010-01-08T00:42:12.824-08:00</updated><title type='text'>Generate Unique Random Numbers</title><content type='html'>This UDF will generate x unique random numbers between any 2 numbers you specify.&lt;br /&gt;&lt;br /&gt;Function RandLotto(Bottom As Integer, Top As Integer, _&lt;br /&gt;&lt;br /&gt;                    Amount As Integer) As String&lt;br /&gt;&lt;br /&gt;    Dim iArr As Variant&lt;br /&gt;&lt;br /&gt;    Dim i As Integer&lt;br /&gt;&lt;br /&gt;    Dim r As Integer&lt;br /&gt;&lt;br /&gt;    Dim temp As Integer&lt;br /&gt;&lt;br /&gt;    Application.Volatile&lt;br /&gt;&lt;br /&gt;    ReDim iArr(Bottom To Top)&lt;br /&gt;&lt;br /&gt;    For i = Bottom To Top&lt;br /&gt;&lt;br /&gt;        iArr(i) = i&lt;br /&gt;&lt;br /&gt;    Next i&lt;br /&gt;&lt;br /&gt;    For i = Top To Bottom + 1 Step -1&lt;br /&gt;&lt;br /&gt;        r = Int(Rnd() * (i - Bottom + 1)) + Bottom&lt;br /&gt;&lt;br /&gt;        temp = iArr(r)&lt;br /&gt;&lt;br /&gt;        iArr(r) = iArr(i)&lt;br /&gt;&lt;br /&gt;        iArr(i) = temp&lt;br /&gt;&lt;br /&gt;    Next i&lt;br /&gt;&lt;br /&gt;    For i = Bottom To Bottom + Amount - 1&lt;br /&gt;&lt;br /&gt;        RandLotto = RandLotto &amp; " " &amp; iArr(i)&lt;br /&gt;&lt;br /&gt;    Next i&lt;br /&gt;&lt;br /&gt;    RandLotto = Trim(RandLotto)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;=RandLotto(1,20,8)&lt;br /&gt;This would produce 8 unique random numbers between 1 and 20 &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;8 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-5927098480988436570?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/5927098480988436570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/generate-unique-random-numbers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5927098480988436570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5927098480988436570'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/generate-unique-random-numbers.html' title='Generate Unique Random Numbers'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-361349143568063748</id><published>2010-01-06T22:21:00.000-08:00</published><updated>2010-01-06T22:24:54.321-08:00</updated><title type='text'>countif across multiple sheets</title><content type='html'>Countif doesnt work across multiple sheets (3d way).&lt;br /&gt;Example: countif(sheet1:sheet3!A1,"&gt;0") will result in error.&lt;br /&gt;&lt;br /&gt;To fix this, List all the sheet names in a range, say H1:H3&lt;br /&gt;Then write this formula =SUMPRODUCT(COUNTIF(INDIRECT("'"&amp;H1:H3&amp;"'!A1"),"&gt;0"))&lt;br /&gt;&lt;br /&gt;This will work like a charm!!&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;6 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-361349143568063748?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/361349143568063748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/countif-across-multiple-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/361349143568063748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/361349143568063748'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/countif-across-multiple-sheets.html' title='countif across multiple sheets'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4247197862409296023</id><published>2010-01-06T13:26:00.000-08:00</published><updated>2010-01-06T13:31:16.117-08:00</updated><title type='text'>To Capture Last modified date of the file</title><content type='html'>Sub test()&lt;br /&gt;Dim fso As Object, myDir As String, fn As String, myFile As String, myDate As Date, maxDate As Date&lt;br /&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;myDir = "C:\temp"&lt;br /&gt;fn = Dir(myDir &amp; "\*.csv)&lt;br /&gt;Do While fn &lt;&gt; ""&lt;br /&gt;myDate = fso.GetFile(myDir &amp; "\" &amp; fn).DateLastModified&lt;br /&gt;If maxDate &lt; myDate Then&lt;br /&gt;myFile = fn&lt;br /&gt;maxDate = myDate&lt;br /&gt;End If&lt;br /&gt;fn = Dir()&lt;br /&gt;Loop&lt;br /&gt;MsgBox myDir &amp; "\" &amp; fn &amp; " : " &amp; maxDate&lt;br /&gt;End Sub&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4247197862409296023?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4247197862409296023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/to-capture-last-modified-date-of-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4247197862409296023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4247197862409296023'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/to-capture-last-modified-date-of-file.html' title='To Capture Last modified date of the file'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-3911229786387059207</id><published>2010-01-04T21:31:00.000-08:00</published><updated>2010-01-04T21:33:02.768-08:00</updated><title type='text'>Delete/ Remove duplicate rows in Excel</title><content type='html'>Public Sub DeleteDuplicateRows()&lt;br /&gt;'&lt;br /&gt;' This macro deletes duplicate rows in the selection. Duplicates are&lt;br /&gt;' counted in the COLUMN of the active cell.&lt;br /&gt;&lt;br /&gt;Dim Col As Integer&lt;br /&gt;Dim r As Long&lt;br /&gt;Dim C As Range&lt;br /&gt;Dim N As Long&lt;br /&gt;Dim V As Variant&lt;br /&gt;Dim Rng As Range&lt;br /&gt;&lt;br /&gt;On Error GoTo EndMacro&lt;br /&gt;Application.ScreenUpdating = False&lt;br /&gt;Application.Calculation = xlCalculationManual&lt;br /&gt;&lt;br /&gt;Col = ActiveCell.Column&lt;br /&gt;&lt;br /&gt;If Selection.Rows.Count &gt; 1 Then&lt;br /&gt;Set Rng = Selection&lt;br /&gt;Else&lt;br /&gt;Set Rng = ActiveSheet.UsedRange.Rows&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;N = 0&lt;br /&gt;For r = Rng.Rows.Count To 1 Step -1&lt;br /&gt;V = Rng.Cells(r, 1).Value&lt;br /&gt;If Application.WorksheetFunction.CountIf(Rng.Columns(1), V) &gt; 1 Then&lt;br /&gt;Rng.Rows(r).EntireRow.Delete&lt;br /&gt;N = N + 1&lt;br /&gt;End If&lt;br /&gt;Next r&lt;br /&gt;&lt;br /&gt;EndMacro:&lt;br /&gt;&lt;br /&gt;Application.ScreenUpdating = True&lt;br /&gt;Application.Calculation = xlCalculationAutomatic&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;5 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-3911229786387059207?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/3911229786387059207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/delete-remove-duplicate-rows-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3911229786387059207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3911229786387059207'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/delete-remove-duplicate-rows-in-excel.html' title='Delete/ Remove duplicate rows in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-560894888952439921</id><published>2010-01-04T00:37:00.000-08:00</published><updated>2010-01-04T00:43:08.782-08:00</updated><title type='text'>Pivot Table - Clear Old Items</title><content type='html'>Old Items Remain in Pivot Field Dropdowns&lt;br /&gt;&lt;span style="font-size:85%;"&gt;The data in the pivot table source may change, and items that were previously in the source are no longer included. For example, some sales reps may leave the company, and the names of their replacements appear in the source table.&lt;br /&gt;Even after you refresh the pivot table, the names of the old sales reps will appear, along with the new names. In the list at right, Cartier has replace Gill, but Gill still appears in the list.&lt;br /&gt;This pivot table tutorial shows how you can clear the old items either manually or programmatically.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Manually Clear Old Items&lt;br /&gt;&lt;span style="font-size:85%;"&gt;To manually clear the old items from the list:&lt;br /&gt;If you manually created any groups that include the old items, ungroup those items.&lt;br /&gt;Drag the pivot field out of the pivot table.&lt;br /&gt;On the Pivot toolbar, click the Refresh button&lt;br /&gt;Drag the pivot field back to the pivot table&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Change the Retain Items Setting in Excel 2007&lt;br /&gt;&lt;span style="font-size:85%;"&gt;To prevent old items from being retained in an Excel 2007 pivot table, you can change an option setting:&lt;br /&gt;Right-click a cell in the pivot table&lt;br /&gt;Click on PivotTable options&lt;br /&gt;Click on the Data tab&lt;br /&gt;In the Retain Items section, select None from the drop down list.&lt;br /&gt;Click OK, then refresh the pivot table.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Programmatically Clear Old Items&lt;br /&gt;&lt;span style="font-size:85%;"&gt;In Excel 2002, and later versions, you can programmatically change the pivot table properties, to prevent missing items from appearing, or clear items that have appeared.&lt;br /&gt;&lt;br /&gt;Sub DeleteMissingItems2002All()&lt;br /&gt;'prevents unused items in non-OLAP PivotTables&lt;br /&gt;'pivot table tutorial by contextures.com&lt;br /&gt;Dim pt As PivotTable&lt;br /&gt;Dim ws As Worksheet&lt;br /&gt;Dim pc As PivotCache&lt;br /&gt;&lt;br /&gt;'change the settings&lt;br /&gt;For Each ws In ActiveWorkbook.Worksheets&lt;br /&gt;For Each pt In ws.PivotTables&lt;br /&gt;pt.PivotCache.MissingItemsLimit = xlMissingItemsNone&lt;br /&gt;Next pt&lt;br /&gt;Next ws&lt;br /&gt;&lt;br /&gt;'refresh all the pivot caches&lt;br /&gt;For Each pc In ActiveWorkbook.PivotCaches&lt;br /&gt;On Error Resume Next&lt;br /&gt;pc.Refresh&lt;br /&gt;Next pc&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;4 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-560894888952439921?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/560894888952439921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/pivot-table-clear-old-items.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/560894888952439921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/560894888952439921'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/pivot-table-clear-old-items.html' title='Pivot Table - Clear Old Items'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-5700896430398497877</id><published>2010-01-03T02:55:00.000-08:00</published><updated>2010-01-03T02:57:02.118-08:00</updated><title type='text'>Remove hyperlinks from your work</title><content type='html'>If Excel has already converted your written URL into a hyperlink, you can cancel it by right-clicking on the offending address and selecting Hyperlink, Remove Hyperlink from the menu that pops up.&lt;br /&gt;&lt;br /&gt;OR:&lt;br /&gt;&lt;br /&gt;Type the url, press Enter key, and then Ctrl + Z. The text will remain but without a hyperlink.&lt;br /&gt;&lt;br /&gt;OR:&lt;br /&gt;&lt;br /&gt;When Excel automatically creates the hyperlink, click the small star and select 'Stop automatically creating hyperlinks'&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;3 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-5700896430398497877?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/5700896430398497877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/remove-hyperlinks-from-your-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5700896430398497877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/5700896430398497877'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/remove-hyperlinks-from-your-work.html' title='Remove hyperlinks from your work'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-9132054880290165622</id><published>2010-01-01T21:25:00.000-08:00</published><updated>2010-01-01T21:27:04.919-08:00</updated><title type='text'>Enter repetitive data quickly</title><content type='html'>You can use this technique to enter data into a series of noncontiguous/Contiguous cells. Hold down the Ctrl key and click all the cells into which you want to enter data. Then, type the text you want to enter and press Ctrl+Enter. Excel will enter the typed text into all of the cells in the noncontiguous/Contiguous selection. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;2 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-9132054880290165622?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/9132054880290165622/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/enter-repetitive-data-quickly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/9132054880290165622'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/9132054880290165622'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/enter-repetitive-data-quickly.html' title='Enter repetitive data quickly'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1165817502003308346</id><published>2010-01-01T21:21:00.000-08:00</published><updated>2010-01-01T21:22:52.853-08:00</updated><title type='text'>Find the currently active cell</title><content type='html'>If you’ve been scrolling around your spreadsheet and you lose your place, you can jump back to the currently active cell by pressing the [Ctrl] + [Backspace] keys. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;1 January 2010&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1165817502003308346?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1165817502003308346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2010/01/find-currently-active-cell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1165817502003308346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1165817502003308346'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2010/01/find-currently-active-cell.html' title='Find the currently active cell'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-1150306773948881589</id><published>2009-12-31T06:58:00.000-08:00</published><updated>2009-12-31T07:01:22.276-08:00</updated><title type='text'>The Camera Tool in Excel</title><content type='html'>Camera: &lt;span style="font-size:85%;"&gt;Takes a linked picture of the current selection and pastes it in a new location. The picture is linked by a formula that refers to the copied cells, so it is updated when the copied cells change. Click the Camera button to take the picture, and then click where you want to paste the upper-left corner of the selection.&lt;br /&gt;&lt;br /&gt;The Camera Tool in Excel is a very useful tool when it comes to capturing data in Excel that you want to display in another area in Excel or another application. Using copy/paste doesn't always give you the results you want so try the camera tool.&lt;br /&gt;First, add the camera tool to a toolbar in Excel :&lt;br /&gt;&lt;br /&gt;1. Choose View...Toolbars, Customize&lt;br /&gt;2. Click on the Commands tab&lt;br /&gt;3. Select Tools from the Categories list and then scroll down the commands list until you located the Camera tool&lt;br /&gt;4. Click and drag the camera onto any toolbar&lt;br /&gt;5. Click on close&lt;br /&gt;&lt;br /&gt;Using the Camera Tool&lt;br /&gt;&lt;br /&gt;To make a linked Camera picture of a range:&lt;br /&gt;&lt;br /&gt;* Select a range&lt;br /&gt;* Press Camera Icon, a + cursor appears&lt;br /&gt;* Move to destination location and click once - the selected range is copied&lt;br /&gt;* Move, manipulate your live picture as desired&lt;br /&gt;&lt;br /&gt;Since your picture is linked, any changes in the original cells will appear in your picture.&lt;br /&gt;&lt;br /&gt;You can move it anywhere you want, it floats over the rows/columns.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FOR Excel 2007&lt;br /&gt;&lt;br /&gt;Click office Button--&gt;Excel Options --&gt;Customize--&gt;Commands not in ribbon--&gt; Camera&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;31 December 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-1150306773948881589?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/1150306773948881589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/camera-tool-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1150306773948881589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/1150306773948881589'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/camera-tool-in-excel.html' title='The Camera Tool in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-7896314955245266039</id><published>2009-12-30T03:36:00.000-08:00</published><updated>2009-12-30T03:39:09.583-08:00</updated><title type='text'>How to Recover a Corrupt Excel File</title><content type='html'>Microsoft has some great tips for recovering data from Excel files that won't open or are otherwise corrupt although they are sometimes a little difficult to try. See the tips section for them. You may want to try them first, or a combination with the list below.&lt;br /&gt;Steps&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;1.Close down Excel, reopen it and try to open the file again.&lt;br /&gt;&lt;br /&gt;2.If this doesn't work, restart the computer, open up Excel and try to open the file again.&lt;br /&gt;&lt;br /&gt;3.If this doesn't work, delete the contents of your c:\windows\temp directory then reboot. Try again.&lt;br /&gt;&lt;br /&gt;4.If this doesn't work, open Excel in Safe Mode. This will disable VBA and Add-ins. Click on Start then Run then enter (including the quotes and the /s extension): "C:\Program Files\Microsoft Office\Office\excel.exe" /s ["C:\Program Files\Microsoft Office\Office10\excel.exe" /s (for Excel 2002, Office XP, click cancel if the MS Office Installer starts, Excel in safe mode will still start)]. Try to open the file.&lt;br /&gt;&lt;br /&gt;5.If this doesn't work, be sure to scan the file for viruses. Make sure your macro heuristics scanning option is turned on. Ask your IT administrator how to do this.&lt;br /&gt;&lt;br /&gt;6.If you don't find a virus, find the file in Explorer, right click on it and rename it, replacing the .xls extension with the .doc extension. Try to open it as Word document.&lt;br /&gt;&lt;br /&gt;7.If this doesn't work, try to determine if the file is unrecoverable on the disk. Open the file in Explorer and try to copy it to another location. If you can copy the file to another location skip to step 9, if not the actual sectors on the disk may be corrupted. If the data is valuable enough to you, there are several labs that can recover files off damaged disks, you can find a lab here: http://www.disasterrecoverygroup.com/। There are other such services too)। Damaged hard disk file recovery is not for the faint at heart! If you would like to try there are a bunch of free tools starting here:http://www।s2services.com/baddisk.htm. There are several programs you can buy, one for as little as 40$. A good list is here:http://www.webattack.com/shareware/system/swdatarecovery.shtml. The File Recovery program at the top of the list appears to be the best. For recovery from a bad floppy disk download or use a freeware program to recover the file from the floppy. Some freeware for this purpose can be found here:http://www.simtel.net/pub/pd/60018.html and here: http://www.s2services.com/cdzipandfloppyreapir.htm.&lt;br /&gt;&lt;br /&gt;8.Try to open any damaged disk recovered file immediately, miracles do happen.&lt;br /&gt;&lt;br /&gt;9.If the recovered file won't open or you could copy the file to another location, try to open the file in a more recent version of Excel. As the version numbers increase, their ability to recover corrupt files increases. If this doesn't work or such a version of Excel is not available, see if some other spreadsheet application is and try to open the file in that program.&lt;br /&gt;&lt;br /&gt;10.A hopefully exhaustive list of Office Suites is available from Google at: http://directory.google.com/Top/Computers/Software/Office_Suites/. but here is one too: Microsoft Works Spreadsheet, Lotus 123, Quattro Pro, Star Office Calc, ThinkFree Office Calc, Ability Office Spreadsheet, Gobe Productive Spreadsheet, EI Office's Spreadsheet Module, Xoom Office Calc, Open Office Calc (part of the freeware Open Office Suite - similar to Star Office, free business use!) - available at: http://www.openoffice.org/dev_docs/source/1.0.1/index.html, 602 Tab (part of the freeware 602Pro PC Suite 2001, also free for business use!), available at: http://www.software602.com/products/pcs/download.html, Easy Spreadsheet (part of the freeware Easy Office 2001 - $39.95 for business use), available at: http://www.e-press.com/demo_downloads.html, standalone spreadsheets: http://directory.google.com/Top/Computers/Software/Spreadsheets.&lt;br /&gt;&lt;br /&gt;11.If Microsoft can't help you (see the tips section) and you've exhausted all the free methods above for damaged disk recovered or copiable files there are a number of excellent commercial applications which will recover your files almost immediately. Try the free demos first (see "External Links" below).&lt;br /&gt;&lt;br /&gt;12.If you are adventurous, go into Explorer, locate the file again, and rename it with a .txt extension instead of an .xls extension. Try opening the file, and if Windows says it can't open it Notepad but will open it in WordPad, agree. Be sure to turn on word wrapping in either program, in Notepad it's under the Format menu; in WordPad it's under the View menu, choose Options, choose the Text Tab, and choose Wrap to window. Next look for where your data stops, and is followed by a bunch of spacer characters they are little squares. These actually begin to tell Excel where cells, columns and rows are. When you find your last bit of data, delete the rest of the file. After this rename it back to an .xls extension, try opening the file in the oldest version of a spreadsheet you can find, or one of the freeware spreadsheets programs mentioned in Step 9. You may be able to recover your data in some semblance of a spreadsheet.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 30 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-7896314955245266039?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/7896314955245266039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/how-to-recover-corrupt-excel-file.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7896314955245266039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/7896314955245266039'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/how-to-recover-corrupt-excel-file.html' title='How to Recover a Corrupt Excel File'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-824815543818693723</id><published>2009-12-30T03:34:00.000-08:00</published><updated>2009-12-30T03:36:38.633-08:00</updated><title type='text'>Hide the Ribbon in Office 2007</title><content type='html'>Press Control + F1 and ribbon disappears and press again to reappear ribbon. You can also have it disappear so it will come back with a single click on any tab name. To do this, double click a tab name and the ribbon disappears. Single click a tab name and it reappears - click again on the tab or in the document, and it disappears. Repeat until you're tired of the magic! Double click or Control + F1 to go back to how it was. &lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 29 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-824815543818693723?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/824815543818693723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/hide-ribbon-in-office-2007.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/824815543818693723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/824815543818693723'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/hide-ribbon-in-office-2007.html' title='Hide the Ribbon in Office 2007'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4741725214197729212</id><published>2009-12-27T22:21:00.000-08:00</published><updated>2009-12-27T22:26:01.521-08:00</updated><title type='text'>Find First or Last Populated Column in a sheet</title><content type='html'>Code:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Sub Test_xlFirstLastCols()&lt;br /&gt;&lt;br /&gt;' Target Application: MS Excel&lt;br /&gt;' Demonstration: display first and last non-blank columns in the active sheet&lt;br /&gt;' and one target sheet&lt;br /&gt;&lt;br /&gt;Dim SheetName As String&lt;br /&gt;'&lt;br /&gt;' display sheet name and results from xlFindFirstCol and xlFindLastCol&lt;br /&gt;' for the active sheet. Since activesheet is assumed if procs are called&lt;br /&gt;' without a passed arguement, use that method here&lt;br /&gt;'&lt;br /&gt;MsgBox "Worksheet name = " &amp;amp; ActiveSheet.Name &amp;amp; vbCrLf &amp;amp; _&lt;br /&gt;"First non-blank col = " &amp;amp; xlFirstCol() &amp;amp; vbCrLf &amp;amp; _&lt;br /&gt;"Last non-blank col = " &amp;amp; xlLastCol(), vbInformation, _&lt;br /&gt;"Active Sheet Demonstration"&lt;br /&gt;'&lt;br /&gt;' display sheet name and results from xlFindFirstCol and xlFindLastCol&lt;br /&gt;' for "Sheet4". Since this is not the active sheet, the sheet must&lt;br /&gt;' be defined via the passed arguement.&lt;br /&gt;'&lt;br /&gt;SheetName = "Sheet4"&lt;br /&gt;MsgBox "Worksheet name = " &amp;amp; SheetName &amp;amp; vbCrLf &amp;amp; _&lt;br /&gt;"First non-blank col = " &amp;amp; xlFirstCol(SheetName) &amp;amp; vbCrLf &amp;amp; _&lt;br /&gt;"Last non-blank col = " &amp;amp; xlLastCol(SheetName), vbInformation, _&lt;br /&gt;"Passed Sheet Name Demonstration"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Function xlFirstCol(Optional WorksheetName As String) As Long&lt;br /&gt;&lt;br /&gt;' finds the first populated col in a worksheet&lt;br /&gt;&lt;br /&gt;If WorksheetName = vbNullString Then WorksheetName = ActiveSheet.Name&lt;br /&gt;With Worksheets(WorksheetName)&lt;br /&gt;On Error Resume Next&lt;br /&gt;xlFirstCol = .Cells.Find("*", .Cells(.Cells.Count), xlFormulas, _&lt;br /&gt;xlWhole, xlByColumns, xlNext).Column&lt;br /&gt;If Err &lt;&gt; 0 Then xlFirstCol = 0&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Function xlLastCol(Optional WorksheetName As String) As Long&lt;br /&gt;&lt;br /&gt;' finds the last populated col in a worksheet&lt;br /&gt;&lt;br /&gt;If WorksheetName = vbNullString Then WorksheetName = ActiveSheet.Name&lt;br /&gt;With Worksheets(WorksheetName)&lt;br /&gt;On Error Resume Next&lt;br /&gt;xlLastCol = .Cells.Find("*", .Cells(1), xlFormulas, _&lt;br /&gt;xlWhole, xlByColumns, xlPrevious).Column&lt;br /&gt;If Err &lt;&gt; 0 Then xlLastCol = 0&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;How to use:&lt;br /&gt;&lt;br /&gt;Copy the above code.&lt;br /&gt;Open any workbook.&lt;br /&gt;Press Alt + F11 to open the Visual Basic Editor (VBE).&lt;br /&gt;In the left side window, select the target spreadsheet [it will likely be called VBAProject(name.xls) where name is the name of the spreadsheet]&lt;br /&gt;Select an existing code module for the target worksheet; or from the Insert Menu, choose Insert  Module.&lt;br /&gt;Paste the code into the right-hand code window.&lt;br /&gt;Close the VBE, save the file if desired.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Test the code:&lt;br /&gt;&lt;br /&gt;In the attached example, there are 5 sheets with varying amounts of data.&lt;br /&gt;Select any of these sheets (or create another sheet)&lt;br /&gt;Go to Tools  Macro  Macros (or Alt+F8) and double-click on Test_xlFirstLastCols&lt;br /&gt;The results for the active sheet and Sheet4 will be displayed.&lt;br /&gt;Each sheet has a text box with info on what you should expect from the demo. You may also click on any of these text boxes to execute the demo.&lt;br /&gt;(N.B. if you select Sheet4 as the active sheet the same result will be displayed twice.&lt;br /&gt;xlFirstCol and xlLastCol are functions to be called by a higher level procedure, further testing will depend on how the functions are used). &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 28 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4741725214197729212?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4741725214197729212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/find-first-or-last-populated-column-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4741725214197729212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4741725214197729212'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/find-first-or-last-populated-column-in.html' title='Find First or Last Populated Column in a sheet'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-49276806329893715</id><published>2009-12-27T03:52:00.000-08:00</published><updated>2009-12-27T03:54:43.932-08:00</updated><title type='text'>Other Shortcut Keys in Excel</title><content type='html'>Key Description&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;ARROW KEYS Move one cell up, down, left, or right in a worksheet.&lt;br /&gt;CTRL+ARROW KEY moves to the edge of the current data region (data region: A range of cells that contains data and that is bounded by empty cells or datasheet borders.) in a worksheet.&lt;br /&gt;&lt;br /&gt;SHIFT+ARROW KEY extends the selection of cells by one cell.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+ARROW KEY extends the selection of cells to the last nonblank cell in the same column or row as the active cell.&lt;br /&gt;&lt;br /&gt;LEFT ARROW or RIGHT ARROW selects the menu to the left or right when a menu is visible. When a submenu is open, these arrow keys switch between the main menu and the submenu.&lt;br /&gt;&lt;br /&gt;DOWN ARROW or UP ARROW selects the next or previous command when a menu or submenu is open.&lt;br /&gt;&lt;br /&gt;In a dialog box, arrow keys move between options in an open drop-down list, or between options in a group of options.&lt;br /&gt;&lt;br /&gt;ALT+DOWN ARROW opens a selected drop-down list.&lt;br /&gt;&lt;br /&gt;BACKSPACE Deletes one character to the left in the Formula Bar.&lt;br /&gt;Also clears the content of the active cell.&lt;br /&gt;&lt;br /&gt;DELETE Removes the cell contents (data and formulas) from selected cells without affecting cell formats or comments.&lt;br /&gt;In cell editing mode, it deletes the character to the right of the insertion point.&lt;br /&gt;&lt;br /&gt;END Moves to the cell in the lower-right corner of the window when SCROLL LOCK is turned on.&lt;br /&gt;Also selects the last command on the menu when a menu or submenu is visible.&lt;br /&gt;&lt;br /&gt;CTRL+END moves to the last cell on a worksheet, in the lowest used row of the rightmost used column.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+END extends the selection of cells to the last used cell on the worksheet (lower-right corner).&lt;br /&gt;&lt;br /&gt;ENTER Completes a cell entry from the cell or the Formula Bar, and selects the cell below (by default).&lt;br /&gt;In a data form, it moves to the first field in the next record.&lt;br /&gt;&lt;br /&gt;Opens a selected menu (press F10 to activate the menu bar) or performs the action for a selected command.&lt;br /&gt;&lt;br /&gt;In a dialog box, it performs the action for the default command button in the dialog box (the button with the bold outline, often the OK button).&lt;br /&gt;&lt;br /&gt;ALT+ENTER starts a new line in the same cell.&lt;br /&gt;&lt;br /&gt;CTRL+ENTER fills the selected cell range with the current entry.&lt;br /&gt;&lt;br /&gt;SHIFT+ENTER completes a cell entry and selects the cell above.&lt;br /&gt;&lt;br /&gt;ESC Cancels an entry in the cell or Formula Bar.&lt;br /&gt;It also closes an open menu or submenu, dialog box, or message window.&lt;br /&gt;&lt;br /&gt;HOME Moves to the beginning of a row in a worksheet.&lt;br /&gt;Moves to the cell in the upper-left corner of the window when SCROLL LOCK is turned on.&lt;br /&gt;&lt;br /&gt;Selects the first command on the menu when a menu or submenu is visible.&lt;br /&gt;&lt;br /&gt;CTRL+HOME moves to the beginning of a worksheet.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+HOME extends the selection of cells to the beginning of the worksheet.&lt;br /&gt;&lt;br /&gt;PAGE DOWN Moves one screen down in a worksheet.&lt;br /&gt;ALT+PAGE DOWN moves one screen to the right in a worksheet.&lt;br /&gt;&lt;br /&gt;CTRL+PAGE DOWN moves to the next sheet in a workbook.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+PAGE DOWN selects the current and next sheet in a workbook.&lt;br /&gt;&lt;br /&gt;PAGE UP Moves one screen up in a worksheet.&lt;br /&gt;ALT+PAGE UP moves one screen to the left in a worksheet.&lt;br /&gt;&lt;br /&gt;CTRL+PAGE UP moves to the previous sheet in a workbook.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+PAGE UP selects the current and previous sheet in a workbook.&lt;br /&gt;&lt;br /&gt;SPACEBAR In a dialog box, performs the action for the selected button, or selects or clears a check box.&lt;br /&gt;CTRL+SPACEBAR selects an entire column in a worksheet.&lt;br /&gt;&lt;br /&gt;SHIFT+SPACEBAR selects an entire row in a worksheet.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+SPACEBAR selects the entire worksheet.&lt;br /&gt;&lt;br /&gt;If the worksheet contains data, CTRL+SHIFT+SPACEBAR selects the current region. Pressing CTRL+SHIFT+SPACEBAR a second time selects the entire worksheet.&lt;br /&gt;When an object is selected, CTRL+SHIFT+SPACEBAR selects all objects on a worksheet.&lt;br /&gt;ALT+SPACEBAR displays the Control menu for the Excel window.&lt;br /&gt;&lt;br /&gt;TAB Moves one cell to the right in a worksheet.&lt;br /&gt;Moves between unlocked cells in a protected worksheet.&lt;br /&gt;&lt;br /&gt;Moves to the next option or option group in a dialog box.&lt;br /&gt;&lt;br /&gt;SHIFT+TAB moves to the previous cell in a worksheet or the previous option in a dialog box.&lt;br /&gt;&lt;br /&gt;CTRL+TAB switches to the next tab in dialog box.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+TAB switches to the previous tab in a dialog box.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 27 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-49276806329893715?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/49276806329893715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/other-shortcut-keys-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/49276806329893715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/49276806329893715'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/other-shortcut-keys-in-excel.html' title='Other Shortcut Keys in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2979481157674320171</id><published>2009-12-26T06:35:00.000-08:00</published><updated>2009-12-26T06:42:09.086-08:00</updated><title type='text'>Function key shortcuts in Excel</title><content type='html'>Key        Description&lt;br /&gt;&lt;span style="font-size:85%;"&gt;F1 Displays the Help task pane.&lt;br /&gt;CTRL+F1 closes and reopens the current task pane.&lt;br /&gt;&lt;br /&gt;ALT+F1 creates a chart of the data in the current range.&lt;br /&gt;&lt;br /&gt;ALT+SHIFT+F1 inserts a new worksheet.&lt;br /&gt;&lt;br /&gt;F2 Edits the active cell and positions the insertion point at the end of the cell contents. It also moves the insertion point into the Formula Bar when editing in a cell is turned off.&lt;br /&gt;SHIFT+F2 edits a cell comment.&lt;br /&gt;&lt;br /&gt;F3 Pastes a defined name into a formula.&lt;br /&gt;SHIFT+F3 displays the Insert Function dialog box.&lt;br /&gt;&lt;br /&gt;F4 Repeats the last command or action, if possible.&lt;br /&gt;CTRL+F4 closes the selected workbook window.&lt;br /&gt;&lt;br /&gt;F5 Displays the Go To dialog box.&lt;br /&gt;CTRL+F5 restores the window size of the selected workbook window.&lt;br /&gt;&lt;br /&gt;F6 Switches to the next pane in a worksheet that has been split (Window menu, Split command).&lt;br /&gt;SHIFT+F6 switches to the previous pane in a worksheet that has been split.&lt;br /&gt;&lt;br /&gt;CTRL+F6 switches to the next workbook window when more than one workbook window is open.&lt;br /&gt;&lt;br /&gt;Note When the task pane is visible, F6 and SHIFT+F6 include that pane when switching between panes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;F7 Displays the Spelling dialog box to check spelling in the active worksheet or selected range.&lt;br /&gt;CTRL+F7 performs the Move command on the workbook window when it is not maximized. Use the arrow keys to move the window, and when finished press ESC.&lt;br /&gt;&lt;br /&gt;F8 Turns extend mode on or off. In extend mode, EXT appears in the status line, and the arrow keys extend the selection.&lt;br /&gt;SHIFT+F8 enables you to add a non-adjacent cell or range to a selection of cells by using the arrow keys.&lt;br /&gt;&lt;br /&gt;CTRL+F8 performs the Size command (on the Control menu for the workbook window) when a workbook is not maximized.&lt;br /&gt;&lt;br /&gt;ALT+F8 displays the Macro dialog box to run, edit, or delete a macro.&lt;br /&gt;&lt;br /&gt;F9 Calculates all worksheets in all open workbooks.&lt;br /&gt;F9 followed by ENTER (or followed by CTRL+SHIFT+ENTER for array formulas) calculates the selected a portion of a formula and replaces the selected portion with the calculated value.&lt;br /&gt;&lt;br /&gt;SHIFT+F9 calculates the active worksheet.&lt;br /&gt;&lt;br /&gt;CTRL+ALT+F9 calculates all worksheets in all open workbooks, regardless of whether they have changed since the last calculation.&lt;br /&gt;&lt;br /&gt;CTRL+ALT+SHIFT+F9 rechecks dependent formulas, and then calculates all cells in all open workbooks, including cells not marked as needing to be calculated.&lt;br /&gt;&lt;br /&gt;CTRL+F9 minimizes a workbook window to an icon.&lt;br /&gt;&lt;br /&gt;F10 Selects the menu bar or closes an open menu and submenu at the same time.&lt;br /&gt;SHIFT+F10 displays the shortcut menu for a selected item.&lt;br /&gt;&lt;br /&gt;ALT+SHIFT+F10 displays the menu or message for a smart tag. If more than one smart tag is present, it switches to the next smart tag and displays its menu or message.&lt;br /&gt;&lt;br /&gt;CTRL+F10 maximizes or restores the selected workbook window.&lt;br /&gt;&lt;br /&gt;F11 Creates a chart of the data in the current range.&lt;br /&gt;SHIFT+F11 inserts a new worksheet.&lt;br /&gt;&lt;br /&gt;ALT+F11 opens the Visual Basic Editor, in which you can create a macro by using Visual Basic for Applications (VBA).&lt;br /&gt;&lt;br /&gt;ALT+SHIFT+F11 opens the Microsoft Script Editor, where you can add text, edit HTML tags, and modify any script code.&lt;br /&gt;&lt;br /&gt;F12 Displays the Save As dialog box.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 26 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2979481157674320171?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2979481157674320171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/function-key-shortcuts-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2979481157674320171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2979481157674320171'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/function-key-shortcuts-in-excel.html' title='Function key shortcuts in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2147976274781781411</id><published>2009-12-24T21:36:00.000-08:00</published><updated>2009-12-24T21:38:02.687-08:00</updated><title type='text'>Find the Last used row in a particular sheet</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;There are several methods to accomplish this, some more exact than others, but they can all serve your needs.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One common method&lt;br /&gt;&lt;br /&gt;LastRow = Cells.SpecialCells(xlCellTypeLastCell).Row&lt;br /&gt;&lt;br /&gt;which is not very exact, because Excel doesn't keep track of the last cell in a very adequate form.&lt;br /&gt;&lt;br /&gt;Another method to find the last used row in a particular column is:&lt;br /&gt;&lt;br /&gt;LastRowColA = Range("A65536").End(xlUp).Row&lt;br /&gt;&lt;br /&gt;but this doesn't tell you FOR SURE the last used row in the entire sheet, unless you can be certain that Column A holds the data.&lt;br /&gt;&lt;br /&gt;A couple extra methods are more reliable.&lt;br /&gt;&lt;br /&gt;LastRow = Cells.Find("*",SearchOrder:=xlByRows,SearchDirection:=xlPrevious).Row&lt;br /&gt;or&lt;br /&gt;LastRow = ActiveSheet.UsedRange.Rows.Count&lt;br /&gt;&lt;br /&gt;This methods can be used on any sheet, not just the active sheet.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 25 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2147976274781781411?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2147976274781781411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/find-last-used-row-in-particular-sheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2147976274781781411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2147976274781781411'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/find-last-used-row-in-particular-sheet.html' title='Find the Last used row in a particular sheet'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-2174874024282930834</id><published>2009-12-23T22:38:00.000-08:00</published><updated>2009-12-23T22:42:27.934-08:00</updated><title type='text'>CTRL combination shortcut keys in Excel</title><content type='html'>Key      Description&lt;br /&gt;&lt;span style="font-size:85%;"&gt;CTRL+( Unhides any hidden rows within the selection.&lt;br /&gt;CTRL+) Unhides any hidden columns within the selection.&lt;br /&gt;CTRL+&amp;amp; Applies the outline border to the selected cells.&lt;br /&gt;CTRL+_ Removes the outline border from the selected cells.&lt;br /&gt;CTRL+~ Applies the General number format.&lt;br /&gt;CTRL+$ Applies the Currency format with two decimal places (negative numbers in parentheses).&lt;br /&gt;CTRL+% Applies the Percentage format with no decimal places.&lt;br /&gt;CTRL+^ Applies the Exponential number format with two decimal places.&lt;br /&gt;CTRL+# Applies the Date format with the day, month, and year.&lt;br /&gt;CTRL+@ Applies the Time format with the hour and minute, and AM or PM.&lt;br /&gt;CTRL+! Applies the Number format with two decimal places, thousands separator, and minus sign (-) for negative values.&lt;br /&gt;CTRL+- Displays the Delete dialog box to delete the selected cells.&lt;br /&gt;CTRL+* Selects the current region around the active cell (the data area enclosed by blank rows and blank columns).&lt;br /&gt;In a PivotTable, it selects the entire PivotTable report.&lt;br /&gt;&lt;br /&gt;CTRL+: Enters the current time.&lt;br /&gt;CTRL+; Enters the current date.&lt;br /&gt;CTRL+` Alternates between displaying cell values and displaying formulas in the worksheet.&lt;br /&gt;CTRL+' Copies a formula from the cell above the active cell into the cell or the Formula Bar.&lt;br /&gt;CTRL+" Copies the value from the cell above the active cell into the cell or the Formula Bar.&lt;br /&gt;CTRL++ Displays the Insert dialog box to insert blank cells.&lt;br /&gt;CTRL+1 Displays the Format Cells dialog box.&lt;br /&gt;CTRL+2 Applies or removes bold formatting.&lt;br /&gt;CTRL+3 Applies or removes italic formatting.&lt;br /&gt;CTRL+4 Applies or removes underlining.&lt;br /&gt;CTRL+5 Applies or removes strikethrough.&lt;br /&gt;CTRL+6 Alternates between hiding objects, displaying objects, and displaying placeholders for objects.&lt;br /&gt;CTRL+7 Displays or hides the Standard toolbar.&lt;br /&gt;CTRL+8 Displays or hides the outline symbols.&lt;br /&gt;CTRL+9 Hides the selected rows.&lt;br /&gt;CTRL+0 Hides the selected columns.&lt;br /&gt;CTRL+A Selects the entire worksheet.&lt;br /&gt;If the worksheet contains data, CTRL+A selects the current region. Pressing CTRL+A a second time selects the entire worksheet.&lt;br /&gt;&lt;br /&gt;When the insertion point is to the right of a function name in a formula, displays the Function Arguments dialog box.&lt;br /&gt;&lt;br /&gt;CTRL+SHIFT+A inserts the argument names and parentheses when the insertion point is to the right of a function name in a formula.&lt;br /&gt;&lt;br /&gt;CTRL+B Applies or removes bold formatting.&lt;br /&gt;CTRL+C Copies the selected cells.&lt;br /&gt;CTRL+C followed by another CTRL+C displays the Microsoft Office Clipboard.&lt;br /&gt;&lt;br /&gt;CTRL+D Uses the Fill Down command to copy the contents and format of the topmost cell of a selected range into the cells below.&lt;br /&gt;CTRL+F Displays the Find dialog box.&lt;br /&gt;SHIFT+F5 also displays this dialog box, while SHIFT+F4 repeats the last Find action.&lt;br /&gt;&lt;br /&gt;CTRL+G Displays the Go To dialog box.&lt;br /&gt;F5 also displays this dialog box.&lt;br /&gt;&lt;br /&gt;CTRL+H Displays the Find and Replace dialog box.&lt;br /&gt;CTRL+I Applies or removes italic formatting.&lt;br /&gt;CTRL+K Displays the Insert Hyperlink dialog box for new hyperlinks or the Edit Hyperlink dialog box for selected existing hyperlinks.&lt;br /&gt;CTRL+L Displays the Create List dialog box.&lt;br /&gt;CTRL+N Creates a new, blank file.&lt;br /&gt;CTRL+O Displays the Open dialog box to open or find a file.&lt;br /&gt;CTRL+SHIFT+O selects all cells that contain comments.&lt;br /&gt;&lt;br /&gt;CTRL+P Displays the Print dialog box.&lt;br /&gt;CTRL+R Uses the Fill Right command to copy the contents and format of the leftmost cell of a selected range into the cells to the right.&lt;br /&gt;CTRL+S Saves the active file with its current file name, location, and file format.&lt;br /&gt;CTRL+U Applies or removes underlining.&lt;br /&gt;CTRL+V Inserts the contents of the Clipboard at the insertion point and replaces any selection. Available only after you cut or copied an object, text, or cell contents.&lt;br /&gt;CTRL+W Closes the selected workbook window.&lt;br /&gt;CTRL+X Cuts the selected cells.&lt;br /&gt;CTRL+Y Repeats the last command or action, if possible.&lt;br /&gt;CTRL+Z Uses the Undo command to reverse the last command or to delete the last entry you typed.&lt;br /&gt;CTRL+SHIFT+Z uses the Undo or Redo command to reverse or restore the last automatic correction when AutoCorrect Smart Tags are displayed. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 24 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-2174874024282930834?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/2174874024282930834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/ctrl-combination-shortcut-keys-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2174874024282930834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/2174874024282930834'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/ctrl-combination-shortcut-keys-in-excel.html' title='CTRL combination shortcut keys in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-3623511531537917893</id><published>2009-12-22T21:29:00.000-08:00</published><updated>2009-12-22T21:33:52.447-08:00</updated><title type='text'>convert a numeric value into English words in Excel</title><content type='html'># Start Microsoft Excel.&lt;br /&gt;# Press ALT+F11 to start the Visual Basic Editor.&lt;br /&gt;# On the Insert menu, click Module.&lt;br /&gt;# Type the following code into the module sheet.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Option Explicit&lt;br /&gt;'Main Function&lt;br /&gt;Function SpellNumber(ByVal MyNumber)&lt;br /&gt;Dim Dollars, Cents, Temp&lt;br /&gt;Dim DecimalPlace, Count&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;' String representation of amount.&lt;br /&gt;MyNumber = Trim(Str(MyNumber))&lt;br /&gt;' Position of decimal place 0 if none.&lt;br /&gt;DecimalPlace = InStr(MyNumber, ".")&lt;br /&gt;' Convert cents and set MyNumber to dollar amount.&lt;br /&gt;If DecimalPlace &gt; 0 Then&lt;br /&gt;Cents = 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;Count = 1&lt;br /&gt;Do While MyNumber &lt;&gt; ""&lt;br /&gt;Temp = GetHundreds(Right(MyNumber, 3))&lt;br /&gt;If Temp &lt;&gt; "" Then Dollars = Temp &amp;amp; Place(Count) &amp;amp; Dollars&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;Loop&lt;br /&gt;Select Case Dollars&lt;br /&gt;Case ""&lt;br /&gt;Dollars = "No Dollars"&lt;br /&gt;Case "One"&lt;br /&gt;Dollars = "One Dollar"&lt;br /&gt;Case Else&lt;br /&gt;Dollars = Dollars &amp;amp; " Dollars"&lt;br /&gt;End Select&lt;br /&gt;Select Case Cents&lt;br /&gt;Case ""&lt;br /&gt;Cents = " and No Cents"&lt;br /&gt;Case "One"&lt;br /&gt;Cents = " and One Cent"&lt;br /&gt;Case Else&lt;br /&gt;Cents = " and " &amp;amp; Cents &amp;amp; " Cents"&lt;br /&gt;End Select&lt;br /&gt;SpellNumber = Dollars &amp;amp; Cents&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;' Converts a number from 100-999 into text&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;' 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;' Converts a number from 10 to 99 into text.&lt;br /&gt;Function GetTens(TensText)&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;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;' Converts a number from 1 to 9 into text.&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;/span&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 23 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-3623511531537917893?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/3623511531537917893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/convert-numeric-value-into-english.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3623511531537917893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3623511531537917893'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/convert-numeric-value-into-english.html' title='convert a numeric value into English words in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-3515900170116446256</id><published>2009-12-21T23:27:00.000-08:00</published><updated>2009-12-21T23:42:19.747-08:00</updated><title type='text'>Hide Cell Contents in Excel</title><content type='html'>&lt;p&gt;&lt;span style="font-size:85%;"&gt;Start Microsoft Excel and open an existing workbook that contains cells you would like to hide the contents of, or start a new workbook and enter some content into a cell that you would like to hide. &lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;p&gt;&lt;br /&gt;Select the cells that contain data you would like to hide. You can select cells by clicking on them and using the SHIFT or CTRL keys on your keyboard to select additional cells. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Choose the "Format" menu and click "Cells" to open the "Format Cells" dialog box. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Click on the "Number" tab in the "Format Cells" dialog box to display the formats that can be applied to Excel cells. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Select "Custom" from the "Category" text box so you can type your own custom formatting to hide your selected cells. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Type 3 semicolons (;;;) in the "Type" text box to tell Excel that you want to hide the cells. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Click the "OK" button to close the "Format Cells" dialog box and hide the selected cells.&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 22 2009&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-3515900170116446256?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/3515900170116446256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/hide-cell-contents-in-excel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3515900170116446256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/3515900170116446256'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/hide-cell-contents-in-excel.html' title='Hide Cell Contents in Excel'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-4373879870493428067</id><published>2009-12-20T20:56:00.000-08:00</published><updated>2009-12-20T21:00:35.692-08:00</updated><title type='text'>Lock and Protect Cells Containing Formulas</title><content type='html'>This is taken from the Excel Hacks by Orielly. Very useful one to protect only few cells in a worksheet.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;When we create a spreadsheet, most of us need to use formulas of some sort. Sometimes, however, you might not want other users to tamper/delete/overtype any formulas you included on your spreadsheet. The easiest and most common way of barring people from playing with your formulas is to protect your worksheet. However, protecting your worksheet doesn't just prevent users from tampering with your formulas, it also stops users from entering anything at all. Sometimes you do not want to go this far.&lt;br /&gt;&lt;br /&gt;By default, all cells on a worksheet are locked; however, this has no effect unless worksheet protection has been applied. Here is a very easy way to apply worksheet protection so that only formula cells are locked and protected.&lt;br /&gt;&lt;br /&gt;Select all cells on your worksheet, either by pressing Ctrl/&amp;command;-A or by clicking the gray square at the intersecting point of column A and row 1. Then select Format → Cells → Protection and uncheck the Locked checkbox to remove the tick. Click OK.&lt;br /&gt;&lt;br /&gt;Now select any single cell, select Edit → Go To... (Ctrl-G or F5), and click Special. You'll see a dialog box such as that in .&lt;br /&gt;&lt;br /&gt;Select Formulas from the Go To Special dialog and, if needed, limit the formulas to the subtypes underneath. Click OK. With only the formula cells selected, select Format → Cells → Protection and check the Locked checkbox to insert a tick. Select OK. Now select Tools → Protection → Protect Worksheet to protect your worksheet and apply a password if required.&lt;br /&gt;&lt;br /&gt;The preceding method certainly saves a lot of time and eliminates possible errors locating formulas so that you can protect them. Unfortunately, it can also prevent users from using certain features, such as sorting, formatting changes, aligning text, and many others you might not be concerned with, even when in an unlocked cell. You can overcome this problem in two ways.&lt;br /&gt;&lt;br /&gt;The first approach doesn't use worksheet protection at all, and uses data validation instead.&lt;br /&gt;&lt;br /&gt;WARNING&lt;br /&gt;&lt;br /&gt;Data validation is far from bulletproof when it comes to preventing users from entering nonvalidated data into cells. Users can still paste into a validated cell any data they want and, in doing so, remove the validation from that cell unless the copied cell also contains data validation, in which case this validation would override the original validation.&lt;br /&gt;&lt;br /&gt;To see what we mean, select any single cell, select Edit → Go To... (Ctrl-G or F5), and click Special. Now select Formulas from the Go To Special dialog and, if needed, limit the formulas to the subtypes underneath. Click OK.&lt;br /&gt;&lt;br /&gt;With only the Formula cells selected, select the Data → Validation → Settings page tab, select Custom from the Allow: box, and in the Formula box, enter ="", as shown in . Click OK.&lt;br /&gt;&lt;br /&gt;This method will prevent a user from accidentally overtyping into any formula cells — although, as stressed in the earlier warning, it is not a fully secure method and should be used only for accidental overtyping, etc. However, the big advantage to using this method is that all of Excel's features are still usable on the worksheet.&lt;br /&gt;&lt;br /&gt;The last method also will enable you to use all of Excel's features, but only when you are in a cell that is not locked. To start, ensure that only the cells you want protected are locked and that all other cells are unlocked. Right-click the Sheet Name tab, select View Code from the pop-up menu, and enter the following code:&lt;br /&gt;&lt;br /&gt;Private Sub Worksheet_SelectionChange(ByVal Target As Range)&lt;br /&gt;If Target.Locked = True Then&lt;br /&gt;Me.Protect Password:="Secret"&lt;br /&gt;Else&lt;br /&gt;Me.Unprotect Password:="Secret"&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;If no password is used, omit Password:="Secret". If a password is used, change the word Secret to your password. Press Alt/&amp;command;-Q or click the X in the top righthand corner to get back to Excel and save your workbook. Now, each time you select a cell that is locked, your worksheet will automatically protect itself. The moment you select any cell that is not locked, your worksheet will unprotect itself.&lt;br /&gt;&lt;br /&gt;WARNING&lt;br /&gt;&lt;br /&gt;This hack doesn't work perfectly, though it usually works well enough. The keyword used in the code, Target, will refer only to the cell that is active at the time of selection. For this reason, it is important to note that if a user selects a range of cells (with the active cell being an unlocked cell), it is possible for him to delete the entire selection because the target cell is unlocked and, therefore, the worksheet automatically will unprotect itself.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Praveen KVC&lt;br /&gt;December 21 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-4373879870493428067?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/4373879870493428067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/lock-and-protect-cells-containing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4373879870493428067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/4373879870493428067'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/lock-and-protect-cells-containing.html' title='Lock and Protect Cells Containing Formulas'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8841484287833312061.post-688747290170301563</id><published>2009-12-20T01:55:00.000-08:00</published><updated>2009-12-20T02:06:48.328-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VBA'/><category scheme='http://www.blogger.com/atom/ns#' term='Password Breaker'/><title type='text'>Password Breaker for Excel sheets</title><content type='html'>I Got this code from Sharat in a Excel Discussion Forum.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;Sub Button2_Click()&lt;br /&gt;&lt;br /&gt;' Breaks worksheet and workbook structure passwords.&lt;br /&gt;' probably originator of base code algorithm modified for coverage&lt;br /&gt;' of workbook structure / windows passwords and for multiple passwords&lt;br /&gt;' Reveals hashed passwords NOT original passwords&lt;br /&gt;Const DBLSPACE As String = vbNewLine &amp;amp; vbNewLine&lt;br /&gt;Const AUTHORS As String = DBLSPACE &amp;amp; vbNewLine &amp;amp; _&lt;br /&gt;"Adapted from Bob McCormick base code by" &amp;amp; _&lt;br /&gt;"Norman Harker and JE McGimpsey"&lt;br /&gt;Const HEADER As String = "AllInternalPasswords User Message"&lt;br /&gt;Const VERSION As String = DBLSPACE &amp;amp; "Version 1.1.1 2003-Apr-04"&lt;br /&gt;Const REPBACK As String = DBLSPACE &amp;amp; "Please report failure " &amp;amp; _&lt;br /&gt;"to the microsoft.public.excel.programming newsgroup."&lt;br /&gt;Const ALLCLEAR As String = DBLSPACE &amp;amp; "The workbook should " &amp;amp; _&lt;br /&gt;"now be free of all password protection, so make sure you:" &amp;amp; _&lt;br /&gt;DBLSPACE &amp;amp; "SAVE IT NOW!" &amp;amp; DBLSPACE &amp;amp; "and also" &amp;amp; _&lt;br /&gt;DBLSPACE &amp;amp; "BACKUP!, BACKUP!!, BACKUP!!!" &amp;amp; _&lt;br /&gt;DBLSPACE &amp;amp; "Also, remember that the password was " &amp;amp; _&lt;br /&gt;"put there for a reason. Don't stuff up crucial formulas " &amp;amp; _&lt;br /&gt;"or data." &amp;amp; DBLSPACE &amp;amp; "Access and use of some data " &amp;amp; _&lt;br /&gt;"may be an offense. If in doubt, don't."&lt;br /&gt;Const MSGNOPWORDS1 As String = "There were no passwords on " &amp;amp; _&lt;br /&gt;"sheets, or workbook structure or windows." &amp;amp; AUTHORS &amp;amp; VERSION&lt;br /&gt;Const MSGNOPWORDS2 As String = "There was no protection to " &amp;amp; _&lt;br /&gt;"workbook structure or windows." &amp;amp; DBLSPACE &amp;amp; _&lt;br /&gt;"Proceeding to unprotect sheets." &amp;amp; AUTHORS &amp;amp; VERSION&lt;br /&gt;Const MSGTAKETIME As String = "After pressing OK button this " &amp;amp; _&lt;br /&gt;"will take some time." &amp;amp; DBLSPACE &amp;amp; "Amount of time " &amp;amp; _&lt;br /&gt;"depends on how many different passwords, the " &amp;amp; _&lt;br /&gt;"passwords, and your computer's specification." &amp;amp; DBLSPACE &amp;amp; _&lt;br /&gt;"Just be patient! Make me a coffee!" &amp;amp; AUTHORS &amp;amp; VERSION&lt;br /&gt;Const MSGPWORDFOUND1 As String = "You had a Worksheet " &amp;amp; _&lt;br /&gt;"Structure or Windows Password set." &amp;amp; DBLSPACE &amp;amp; _&lt;br /&gt;"The password found was: " &amp;amp; DBLSPACE &amp;amp; "$$" &amp;amp; DBLSPACE &amp;amp; _&lt;br /&gt;"Note it down for potential future use in other workbooks by" &amp;amp; _&lt;br /&gt;"the same person who set this password." &amp;amp; DBLSPACE &amp;amp; _&lt;br /&gt;"Now to check and clear other passwords." &amp;amp; AUTHORS &amp;amp; VERSION&lt;br /&gt;Const MSGPWORDFOUND2 As String = "You had a Worksheet " &amp;amp; _&lt;br /&gt;"password set." &amp;amp; DBLSPACE &amp;amp; "The password found was: " &amp;amp; _&lt;br /&gt;DBLSPACE &amp;amp; "$$" &amp;amp; DBLSPACE &amp;amp; "Note it down for potential " &amp;amp; _&lt;br /&gt;"future use in other workbooks by same person who " &amp;amp; _&lt;br /&gt;"set this password." &amp;amp; DBLSPACE &amp;amp; "Now to check and clear " &amp;amp; _&lt;br /&gt;"other passwords." &amp;amp; AUTHORS &amp;amp; VERSION&lt;br /&gt;Const MSGONLYONE As String = "Only structure / windows " &amp;amp; _&lt;br /&gt;"protected with the password that was just found." &amp;amp; _&lt;br /&gt;ALLCLEAR &amp;amp; AUTHORS &amp;amp; VERSION &amp;amp; REPBACK&lt;br /&gt;Dim w1 As Worksheet, w2 As Worksheet&lt;br /&gt;Dim i As Integer, j As Integer, k As Integer, l As Integer&lt;br /&gt;Dim m As Integer, n As Integer, i1 As Integer, i2 As Integer&lt;br /&gt;Dim i3 As Integer, i4 As Integer, i5 As Integer, i6 As Integer&lt;br /&gt;Dim PWord1 As String&lt;br /&gt;Dim ShTag As Boolean, WinTag As Boolean&lt;br /&gt;&lt;br /&gt;Application.ScreenUpdating = False&lt;br /&gt;With ActiveWorkbook&lt;br /&gt;WinTag = .ProtectStructure Or .ProtectWindows&lt;br /&gt;End With&lt;br /&gt;ShTag = False&lt;br /&gt;For Each w1 In Worksheets&lt;br /&gt;ShTag = ShTag Or w1.ProtectContents&lt;br /&gt;Next w1&lt;br /&gt;If Not ShTag And Not WinTag Then&lt;br /&gt;MsgBox MSGNOPWORDS1, vbInformation, HEADER&lt;br /&gt;Exit Sub&lt;br /&gt;End If&lt;br /&gt;MsgBox MSGTAKETIME, vbInformation, HEADER&lt;br /&gt;If Not WinTag Then&lt;br /&gt;MsgBox MSGNOPWORDS2, vbInformation, HEADER&lt;br /&gt;Else&lt;br /&gt;On Error Resume Next&lt;br /&gt;Do 'dummy do loop&lt;br /&gt;For i = 65 To 66: For j = 65 To 66: For k = 65 To 66&lt;br /&gt;For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66&lt;br /&gt;For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66&lt;br /&gt;For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126&lt;br /&gt;With ActiveWorkbook&lt;br /&gt;.Unprotect Chr(i) &amp;amp; Chr(j) &amp;amp; Chr(k) &amp;amp; _&lt;br /&gt;Chr(l) &amp;amp; Chr(m) &amp;amp; Chr(i1) &amp;amp; Chr(i2) &amp;amp; _&lt;br /&gt;Chr(i3) &amp;amp; Chr(i4) &amp;amp; Chr(i5) &amp;amp; Chr(i6) &amp;amp; Chr(n)&lt;br /&gt;If .ProtectStructure = False And _&lt;br /&gt;.ProtectWindows = False Then&lt;br /&gt;PWord1 = Chr(i) &amp;amp; Chr(j) &amp;amp; Chr(k) &amp;amp; Chr(l) &amp;amp; _&lt;br /&gt;Chr(m) &amp;amp; Chr(i1) &amp;amp; Chr(i2) &amp;amp; Chr(i3) &amp;amp; _&lt;br /&gt;Chr(i4) &amp;amp; Chr(i5) &amp;amp; Chr(i6) &amp;amp; Chr(n)&lt;br /&gt;MsgBox Application.Substitute(MSGPWORDFOUND1, _&lt;br /&gt;"$$", PWord1), vbInformation, HEADER&lt;br /&gt;Exit Do 'Bypass all for...nexts&lt;br /&gt;End If&lt;br /&gt;End With&lt;br /&gt;Next: Next: Next: Next: Next: Next&lt;br /&gt;Next: Next: Next: Next: Next: Next&lt;br /&gt;Loop Until True&lt;br /&gt;On Error GoTo 0&lt;br /&gt;End If&lt;br /&gt;If WinTag And Not ShTag Then&lt;br /&gt;MsgBox MSGONLYONE, vbInformation, HEADER&lt;br /&gt;Exit Sub&lt;br /&gt;End If&lt;br /&gt;On Error Resume Next&lt;br /&gt;For Each w1 In Worksheets&lt;br /&gt;'Attempt clearance with PWord1&lt;br /&gt;w1.Unprotect PWord1&lt;br /&gt;Next w1&lt;br /&gt;On Error GoTo 0&lt;br /&gt;ShTag = False&lt;br /&gt;For Each w1 In Worksheets&lt;br /&gt;'Checks for all clear ShTag triggered to 1 if not.&lt;br /&gt;ShTag = ShTag Or w1.ProtectContents&lt;br /&gt;Next w1&lt;br /&gt;If ShTag Then&lt;br /&gt;For Each w1 In Worksheets&lt;br /&gt;With w1&lt;br /&gt;If .ProtectContents Then&lt;br /&gt;On Error Resume Next&lt;br /&gt;Do 'Dummy do loop&lt;br /&gt;For i = 65 To 66: For j = 65 To 66: For k = 65 To 66&lt;br /&gt;For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66&lt;br /&gt;For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66&lt;br /&gt;For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126&lt;br /&gt;.Unprotect Chr(i) &amp;amp; Chr(j) &amp;amp; Chr(k) &amp;amp; _&lt;br /&gt;Chr(l) &amp;amp; Chr(m) &amp;amp; Chr(i1) &amp;amp; Chr(i2) &amp;amp; Chr(i3) &amp;amp; _&lt;br /&gt;Chr(i4) &amp;amp; Chr(i5) &amp;amp; Chr(i6) &amp;amp; Chr(n)&lt;br /&gt;If Not .ProtectContents Then&lt;br /&gt;PWord1 = Chr(i) &amp;amp; Chr(j) &amp;amp; Chr(k) &amp;amp; Chr(l) &amp;amp; _&lt;br /&gt;Chr(m) &amp;amp; Chr(i1) &amp;amp; Chr(i2) &amp;amp; Chr(i3) &amp;amp; _&lt;br /&gt;Chr(i4) &amp;amp; Chr(i5) &amp;amp; Chr(i6) &amp;amp; Chr(n)&lt;br /&gt;MsgBox Application.Substitute(MSGPWORDFOUND2, _&lt;br /&gt;"$$", PWord1), vbInformation, HEADER&lt;br /&gt;'leverage finding Pword by trying on other sheets&lt;br /&gt;For Each w2 In Worksheets&lt;br /&gt;w2.Unprotect PWord1&lt;br /&gt;Next w2&lt;br /&gt;Exit Do 'Bypass all for...nexts&lt;br /&gt;End If&lt;br /&gt;Next: Next: Next: Next: Next: Next&lt;br /&gt;Next: Next: Next: Next: Next: Next&lt;br /&gt;Loop Until True&lt;br /&gt;On Error GoTo 0&lt;br /&gt;End If&lt;br /&gt;End With&lt;br /&gt;Next w1&lt;br /&gt;End If&lt;br /&gt;MsgBox ALLCLEAR &amp;amp; AUTHORS &amp;amp; VERSION &amp;amp; REPBACK, vbInformation, HEADER&lt;br /&gt;End Sub&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;&lt;/p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Regards,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Praveen KVC&lt;/span&gt;&lt;br /&gt;December 20 2009&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8841484287833312061-688747290170301563?l=learnt2day.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnt2day.blogspot.com/feeds/688747290170301563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnt2day.blogspot.com/2009/12/password-breaker-for-excel-sheets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/688747290170301563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8841484287833312061/posts/default/688747290170301563'/><link rel='alternate' type='text/html' href='http://learnt2day.blogspot.com/2009/12/password-breaker-for-excel-sheets.html' title='Password Breaker for Excel sheets'/><author><name>PRAVEEN KVC</name><uri>http://www.blogger.com/profile/11355440275908638529</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
