Vishesh's blog
Solution-Copy data range to new worksheet
Submitted by Vishesh on 8 November, 2011 - 18:14Solution for problem posted on url
http://excelexperts.com/copy-range-data-new-worksheet-when-matching-data...
Please see attached sheet. Click on the button provided on the sheet.
Customised Progress Bar
Submitted by Vishesh on 29 October, 2011 - 18:23Download the attached Excel workbook to see how the customised progress bar works. To implement this in your project simply copy the form (frmProgress) and general module (modProgressBar). And then, you just need to call ShowProgress procedure like this
Call ShowProgress("Task 4", 10)
- 1 comment
- 9664 reads
VBA code to handle Access Imports and Query
Submitted by Vishesh on 21 October, 2011 - 11:22Public g_objConnection As ADODB.Connection Public Const gc_strDBPath As String = "C:\Test.mdb" Function blnConnectDatabase(strPath As String, strDBPass As String) As Boolean ' If blnFileExists(strPath) = False Then ' GoTo ErrH ' Exit Function ' End If Set g_objConnection = New ADODB.Connection On Error GoTo ErrH g_objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ strPath & ";Jet OLEDB:Database Password=" & strDBPass & ";" On Error GoTo 0 blnConnectDatabas
Solution to Forum Ques
Submitted by Vishesh on 17 September, 2011 - 07:59Solution for Forum Ques on url:
Rows to column solved
Submitted by Vishesh on 15 September, 2011 - 18:02Solution for problem asked in url: http://excelexperts.com/moving-data-rows-columns-depending-unique-conten...
Pls c attached sheet. I have tried to solve it using formula only (no macros as it would need more involvement).
Filter/Find in Array
Submitted by Vishesh on 7 August, 2011 - 07:51Count Array Dimensions
Submitted by Vishesh on 6 August, 2011 - 19:31Create In-Cell Chart in Excel using VBA
Submitted by Vishesh on 5 August, 2011 - 08:26Paste the following code in a general module and pass the required parameters to create an chart in a cell. This code however works with Excel 2007 onwards.
Transpose Back
Submitted by Vishesh on 3 August, 2011 - 09:00Paste the following code in any module and run the Test procedure
Sub Test() Call TransposeBack(Sheet1.Range("A3:D10"), Sheet1.Range("I1")) End Sub Sub TransposeBack(rngData As Range, rngTarget As Range) Dim rngHeader As Range Dim rngId As Range Dim rngCell As Range Dim rngDest As Range Dim lngRept As Long Set rngDest = rngTarget.Offset(1) With rngData Set rngHeader = Intersect(.Rows(1), .Rows(1).O
Code generated ComboBox (ActiveX)
Submitted by Vishesh on 1 August, 2011 - 07:11Web Query Solution
Submitted by Vishesh on 29 July, 2011 - 21:23Solution for problem posted on url:
http://excelexperts.com/automating-pulling-data-website
Please use the attached xl sheet. Change the symbol and click the button to see
- 2 comments
- 8906 reads
Copy Picture from Web to Excel
Submitted by Vishesh on 19 July, 2011 - 16:50- 9 comments
- Read more
- 42646 reads
Array to speed up (Range vs Array)
Submitted by Vishesh on 11 July, 2011 - 16:57Using Array to refer to multiple sheets
Submitted by Vishesh on 10 July, 2011 - 18:41Sub DeleteMultipleSheets() Application.DisplayAlerts = False With ThisWorkbook.Worksheets(Array("Sheet2", "Sheet3")) .Delete End With Application.DisplayAlerts = True End Sub
Abbreviated Month name
Submitted by Vishesh on 10 July, 2011 - 18:18DO NOT take first 3 characters from a month name to get an abbreviated month name. This can give you duplicate results in some languages as first 3 characters of two months may be same.
I have encountered this with the Czech language.
So, use the following:
If the month is 1 i.e. January
So, to get abbreviated month name ALWAYS use
Monthname(1, True)
This will always return standard abbreviated month name.
Deleting all charts & shapes on a sheet
Submitted by Vishesh on 9 July, 2011 - 21:07sub DeleteAllCharts() Sheet1.ChartObjects.delete End Sub
sub DeleteAllShapes() Sheet1.Shapes.SelectAll Selection.Delete End Sub
Create Chart from Array values
Submitted by Vishesh on 9 July, 2011 - 20:39Sub CreateChartFromArray() Dim objCht As ChartObject With Sheet1 Set objCht = .ChartObjects.Add(10, 20, 500, 200) objCht.Chart.ChartWizard .Cells(1) objCht.Chart.SeriesCollection(1).Values = Array(56, 61, 45, 15, 30, 10) objCht.Chart.SeriesCollection(1).XValues = Array("A", "B", "C", "D", "E", "F") End With Set objCht = Nothing End Sub
- 2 comments
- 41675 reads
Export Excel Range to Word Document in a Tabular Format
Submitted by Vishesh on 9 July, 2011 - 20:08Zoom Select Range
Submitted by Vishesh on 9 July, 2011 - 19:59Sub ZoomRange(rngZoom As Range) Application.Goto rngZoom ActiveWindow.Zoom = True End Sub Sub Test() Call ZoomRange(Sheet1.Range("A1:L23")) End Sub
Regular Expression to validate Email address
Submitted by Vishesh on 9 July, 2011 - 19:36Public Function blnEmailValid(ByVal strEmailAdd As String) As Boolean With CreateObject("VBScript.RegExp") .IgnoreCase = True .Global = True .Pattern = "^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$" blnEmailValid = .Test(strEmailAdd) End With End Function Sub Test() MsgBox blnEmailValid("abc@EE.com") End Sub
- 1 comment
- 23715 reads
Remove Duplicates (Get Uniques) Excel 2007
Submitted by Vishesh on 9 July, 2011 - 19:08Sub RemoveDups(rngDups As Range, Optional rngTarget As Range) If rngTarget Is Nothing Then rngDups.RemoveDuplicates Columns:=1, Header:=xlNo Else rngDups.AdvancedFilter Action:=xlFilterCopy, CopyToRange:=rngTarget, Unique:=True End If End Sub Sub Test() Call RemoveDups(ActiveSheet.Range("A1:A10"), ActiveSheet.Range("D1")) End Sub
Simple way to add Event Proc skeleton in a sheet module
Submitted by Vishesh on 1 July, 2011 - 17:08Sub CreateEventProcedure(wks As Worksheet, strEvtProc As String) With ActiveWorkbook.VBProject.VBComponents(wks.CodeName).CodeModule 'Add the blank procedure .CreateEventProc strEvtProc, "Worksheet" End With End Sub Sub TestProc() Call CreateEventProcedure(ThisWorkbook.Worksheets("Sheet2"), "Activate") MsgBox "Goto Sheet2 module in the code window. The activate procedure skeleton is added.", vbInformation, "Excel Experts" End Sub
- 2 comments
- 5819 reads
Calling macro (with/without parameters) from other workbook
Submitted by Vishesh on 13 May, 2011 - 17:21Open/Close CD Tray using VBA
Submitted by Vishesh on 11 May, 2011 - 17:22Declare Sub mciSendStringA Lib "winmm.dll" (ByVal lpstrCommand As String, _ ByVal lpstrReturnString As Any, ByVal uReturnLength As Long, _ ByVal hwndCallback As Long) Sub CDTrayOpen() mciSendStringA "Set CDAudio Door Open", 0&, 0, 0 End Sub Sub CDTrayClose() mciSendStringA "Set CDAudio Door Closed", 0&, 0, 0 End Sub
Check if VBProject is protected
Submitted by Vishesh on 11 May, 2011 - 08:53Function ProtectedVBProject(ByVal wb As Workbook) As Boolean Dim intVBComp As Integer intVBComp = -1 On Error Resume Next intVBComp = wb.VBProject.VBComponents.Count If Err.Number = 1004 Then MsgBox "Add reference to the Microsoft Visual Basic Extensibility Library", vbCritical, "Excel Experts" End If On Error GoTo 0 If intVBComp = -
Show Font List with Example
Submitted by Vishesh on 11 May, 2011 - 08:32Sub ShowInstalledFonts() Const StartRow As Integer = 4 Dim cbcFontName As CommandBarControl, cbrFontCmd As CommandBar, strFormula As String Dim strFontName As String, i As Long, lngFontCount As Long, intFontSize As Integer intFontSize = 10 If intFontSize = 0 Then Exit Sub If intFontSize < 8 Then intFontSize = 8 If intFontSize > 30 Then intFontSize = 30 Set cbcFontName = Application.CommandBars("Formatting").FindControl(ID:=1728)
Dynamic Update solved
Submitted by Vishesh on 9 May, 2011 - 17:06Solution for Question posted on url
http://excelexperts.com/node/1168
I have inserted a column at column A and concatenated the system and discipline. Used Vlookup to get the values. At some places it shows #N/A as there is no exact match of the discipline found.
Generate Summary (Solved)
Submitted by Vishesh on 7 May, 2011 - 18:25The attachment contains the solution for the problem posted on
http://www.excelexperts.com/node/1166
I have added a summary sheet and provided a button to generate the summary. Hope this solves your problem
- 4 comments
- 6766 reads
Display Images and Charts on Form
Submitted by Vishesh on 7 May, 2011 - 07:31Attached is an excel workbook that shows how you can display all images and charts of a workbook on a form. See the general module in the code window to see the code that runs to make it happen. Modify it accordingly to suit your requirements.
Screen Shot:
Reading from Clipboard
Submitted by Vishesh on 30 April, 2011 - 20:21Sub GetTextFromClipboard() 'For DataObject add reference to Microsoft Forms 2.0 Object Library 'If you cannot find this library just add a userform and 'now you will find the library reference.
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