Vishesh's blog
Empty/Blank Modules in Excel
Submitted by Vishesh on 30 April, 2011 - 12:41Public Sub RemoveEmptyModules() 'This CANNOT remove Sheet modules 'Can remove Standard modules and Class modules only 'For this to you should have the option "Trust access to the VBA project object model" 'checked.
Create Shortcut for Notepad on Desktop (VBA)
Submitted by Vishesh on 30 April, 2011 - 12:11List and Type of Drives (VBA)
Submitted by Vishesh on 30 April, 2011 - 11:58Special Folders' Path (VBA)
Submitted by Vishesh on 30 April, 2011 - 11:39- 3 comments
- Read more
- 18994 reads
Evaluate (VBA) for Concatenation
Submitted by Vishesh on 27 April, 2011 - 16:07- 3 comments
- Read more
- 15136 reads
Sheet Protect (User Interface only) using VBA
Submitted by Vishesh on 19 April, 2011 - 14:31Solution for filter by day parts
Submitted by Vishesh on 12 April, 2011 - 16:37Solution for problem on url
http://www.excelexperts.com/node/1139
For the user defined function used in the sample file check its Module.
Solution for filter rows
Submitted by Vishesh on 10 April, 2011 - 07:35Solution to problem given posted on url.
- 1 comment
- 5139 reads
Concatenate Array
Submitted by Vishesh on 23 March, 2011 - 17:59This is a small piece of code that can be used to concatenate the elements of an array.
You can use it on elements of a listbox or combobox. See the attached file for reference.
Function ConcatenateArrayElements(arrElement As Variant, Optional _ strConcatenator As String = ", ") As String ConcatenateArrayElements = Join(arrElement, strConcatenator) End Function
- 1 comment
- 11377 reads
SUMIF - More than 1 Criteria in Excel 2007
Submitted by Vishesh on 15 March, 2011 - 16:21The SUMIF function can be used to sum a range on cells based on certain criteria.
With Excel 2007, Microsoft introduced another addition to SUMIF i.e. SUMIFS that allows you to pass more than one criteria. Both SUMIF and SUMIFS have been explained in the attached workbook. Try changing the values in yellow cells and see how the result under sales column changes...
Solution to Problem
Submitted by Vishesh on 5 March, 2011 - 17:52Solution to problem asked on
http://excelexperts.com/node/1113
I have provided a button on the click of which your required output is generated.
- 2 comments
- 4458 reads
Create Access Table from Excel VBA
Submitted by Vishesh on 5 March, 2011 - 10:54Using the following piece of code you can create an Access table specifying the fields and types of your choice. You don't need to have Access on your system.
Unzip Files (using VBA)
Submitted by Vishesh on 4 March, 2011 - 18:14Here is the small piece of code that unzips file into a target folder. Just use the following code procedure with your own parameter values.
- 14 comments
- Read more
- 153050 reads
AlternativeText Property of Shapes
Submitted by Vishesh on 4 March, 2011 - 17:45All shapes (including Charts) in Excel have AlternativeText property. This property can be used to store some information as well. Following is the code to read and write to AlternativeText property of a shape.
Sub SetAlternativeText() Sheet1.Shapes("Rectangle 1").AlternativeText = "ABC" End Sub Sub GetAlternativeText() MsgBox Sheet1.Shapes("Rectangle 1").AlternativeText End Sub
Set Excel Environment
Submitted by Vishesh on 3 March, 2011 - 15:21Here are a set of commands that you can use to set excel environment.
Custom Properties
Submitted by Vishesh on 3 March, 2011 - 15:02This is how you can create a Custom Property in an Excel Workbook to save information. Go to File->Property (as in pic).
Here is the code to read and write to the Custom Property.
Sub SetProperty() ThisWorkbook.CustomDocumentProperties("EmpName") = "Vishesh" End Sub Sub GetProperty() MsgBox ThisWorkbook.CustomDocumentProperties("EmpName").Value End Sub
Want to automate report - (Solution)
Submitted by Vishesh on 2 March, 2011 - 15:22Solution for problem asked on
- 2 comments
- 6223 reads
Create and Remove Hyperlinks (from VBA)
Submitted by Vishesh on 26 February, 2011 - 21:41Sub Create() Call CreateHyperlink(Sheet1.Range("A1:A10")) End Sub Sub Delete() Call RemoveHyperlink(Sheet1.Range("A1:A10")) End Sub Sub CreateHyperlink(rng As Range) Dim rngCell As Range For Each rngCell In rng rngCell.Hyperlinks.Add rngCell, "", , "Screen_Tip", rngCell.Value Next rngCell End Sub Sub RemoveHyperlink(rng As Range) rng.Hyperlinks.Delete End Sub
Check if exists in List
Submitted by Vishesh on 26 February, 2011 - 21:25Sub Check() If blnExists(Sheet1.Range("C13").Value, Sheet1.ListBoxes("List Box 1")) = True Then MsgBox "Exists" Else MsgBox "Does not exists" End If End Sub Function blnExists(strFind As String, lst As ListBox) As Boolean On Error Resume Next blnExists = (Application.WorksheetFunction.Match(strFind, lst.List, 0) > 0) If Err.Number > 0 Then blnExists = False On Error GoTo 0 End Function </
Assign Macros to Shapes
Submitted by Vishesh on 26 February, 2011 - 21:07This small utility shows how to assign macros to all the shapes in one go. See the code in module modAssignMacros
Form Control vs ActiveX Control
Submitted by Vishesh on 26 February, 2011 - 20:41In Excel 2003
to view Form Controls toolbar: Menu: View->Toolbar->Forms
to view ActiveX toolbar: Menu: View->Toolbar->Control Toolbox
Draw a listbox from each of the toolbars
Form Control:
1. The code is always written in a general module.
2. Right Click the control and using assign macro option choose the right procedure that you want to call on the click/change in that control
To see code for form control goto FormControl module
Zip Files from Excel
Submitted by Vishesh on 11 February, 2011 - 14:51- 15 comments
- Read more
- 98543 reads
Customised Cell Comments
Submitted by Vishesh on 5 February, 2011 - 15:37Create a blank Access Database from Excel
Submitted by Vishesh on 5 February, 2011 - 14:20Record Keeping from Excel to Access
Submitted by Vishesh on 5 February, 2011 - 13:58This is a small utility to show how to use Access as a backend to the Excel interface. Using this utility you can enter data in Excel which is then saved in Access. The use of Access makes the data sharing easier.
Access Database Details used in the example (Create an access database with same details):
Database name: Trade_DB
Table Name: TRADING_DETAILS
Field 1: TradeNumber ; Type: Number
Field 2: Trader ; Type: Text
- 2 comments
- Read more
- 22208 reads
Multi-Level Sort
Submitted by Vishesh on 31 January, 2011 - 09:38This utility works with Excel 2007 version only as Excel 2003 doesn't allow for more than 3-level sorting. Try and use it. Its very useful and easy to use and implement in your own projects.
Quick Immediate Window Commands useful for debugging
Submitted by Vishesh on 30 January, 2011 - 15:101. When you have a form open and you encounter an error and you want to go to the excel sheet
You need to hide the form first before you can click on the sheet
Me.Hide
2. If you want to activate a sheet other than the current activesheet its better to use sheet code name than the names which are displayed in sheet tabs
Sheet3.Activate
3. To display/hide sheet tabs
ActiveWindow.DisplayWorkbookTabs = True
4. If you are working on more than one workbooks, then to activate a particular workbook
Get Values from other workbook without opening
Submitted by Vishesh on 29 January, 2011 - 20:47You can use the following piece of code to get values into an opened workbook from a closed workbook.
Break External Links with other workbooks
Submitted by Vishesh on 29 January, 2011 - 20:37At times you come across the this dialog box when you open an Excel workbook. To get rid of this you can run a small piece of code just once. This code would break all links.
Recent comments
5 years 34 weeks ago
6 years 20 weeks ago
6 years 32 weeks ago
6 years 35 weeks ago
6 years 36 weeks ago
6 years 42 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago