<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>CodeKeep VBA Feed</title>
    <description>The latest and greatest VBA code snippets publicly available</description>
    <link>http://www.codekeep.net/feeds.aspx</link>
    <lastBuildDate>Thu, 01 Nov 2012 16:55:14 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>RSS.NET: http://www.rssdotnet.com/</generator>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CodeKeepVBA" /><feedburner:info uri="codekeepvba" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Excel VBA: Convert To Hyperlinks</title>
      <description>Description: Convert To Hyperlinks&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/1613989e-3906-44fd-a449-3e2726c40c0a.aspx'&gt;http://www.codekeep.net/snippets/1613989e-3906-44fd-a449-3e2726c40c0a.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Public Sub Convert_To_Hyperlinks()
Dim Cell As Range
For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
If Cell &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then
ActiveSheet.Hyperlinks.Add Cell, Cell.Value
End If
Next
End Sub&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/80SkdxuPkxA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/80SkdxuPkxA/1613989e-3906-44fd-a449-3e2726c40c0a.aspx</link>
      <pubDate>Thu, 01 Nov 2012 16:55:14 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/1613989e-3906-44fd-a449-3e2726c40c0a.aspx</feedburner:origLink></item>
    <item>
      <title>UnicodeDecode</title>
      <description>Description: for converting string like "Ph&amp;#250;t gi&amp;#226;y g&amp;#7847;n nhau" to unicode&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/a5b3b62f-2182-4c1a-b3a2-71c9c234680e.aspx'&gt;http://www.codekeep.net/snippets/a5b3b62f-2182-4c1a-b3a2-71c9c234680e.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Public Function UnicodeDecode(StringToDecode As String) As String
    'for converting string like &amp;quot;Ph&amp;amp;#250;t gi&amp;amp;#226;y g&amp;amp;#7847;n nhau&amp;quot; to unicode
  Dim TempAns As String
  Dim CurChr As Integer, iEnd As Integer
  CurChr = 1
   Do Until CurChr &amp;gt; Len(StringToDecode)
    Select Case Mid(StringToDecode, CurChr, 2)
    Case &amp;quot;&amp;amp;#&amp;quot;
        iEnd = InStr(CurChr + 2, StringToDecode, &amp;quot;;&amp;quot;)
        TempAns = TempAns &amp;amp; ChrW(Mid(StringToDecode, CurChr + 2, iEnd - (CurChr + 2)))
        CurChr = iEnd
    Case Else
      TempAns = TempAns &amp;amp; Mid(StringToDecode, CurChr, 1)
    End Select
    CurChr = CurChr + 1
  Loop
  UnicodeDecode = TempAns
End Function
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/jxmxtn3-_XY" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/jxmxtn3-_XY/a5b3b62f-2182-4c1a-b3a2-71c9c234680e.aspx</link>
      <pubDate>Wed, 01 Aug 2012 10:45:23 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/a5b3b62f-2182-4c1a-b3a2-71c9c234680e.aspx</feedburner:origLink></item>
    <item>
      <title>Export the notes text of a PowerPoint presentation</title>
      <description>Description: This macro will export the notes text from each slide in your presentation to the file you specify.&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/114446b3-f5be-4811-9630-f7e4c3286204.aspx'&gt;http://www.codekeep.net/snippets/114446b3-f5be-4811-9630-f7e4c3286204.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub ExportNotesText()

    Dim oSlides As Slides
    Dim oSl As Slide
    Dim oSh As Shape
    Dim strNotesText As String
    Dim strFileName As String
    Dim intFileNum As Integer
    Dim lngReturn As Long

    ' Get a filename to store the collected text
    strFileName = InputBox(&amp;quot;Enter the full path and name of file to extract notes text to&amp;quot;, &amp;quot;Output file?&amp;quot;)

    ' did user cancel?
    If strFileName = &amp;quot;&amp;quot; Then
        Exit Sub
    End If

    ' is the path valid?  crude but effective test:  try to create the file.
    intFileNum = FreeFile()
    On Error Resume Next
    Open strFileName For Output As intFileNum
    If Err.Number &amp;lt;&amp;gt; 0 Then     ' we have a problem
        MsgBox &amp;quot;Couldn't create the file: &amp;quot; &amp;amp; strFileName &amp;amp; vbCrLf _
            &amp;amp; &amp;quot;Please try again.&amp;quot;
        Exit Sub
    End If
    Close #intFileNum  ' temporarily

    ' Get the notes text
    Set oSlides = ActivePresentation.Slides
    For Each oSl In oSlides
        For Each oSh In oSl.NotesPage.Shapes
        If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
            If oSh.HasTextFrame Then
                If oSh.TextFrame.HasText Then
                    strNotesText = strNotesText &amp;amp; &amp;quot;Slide: &amp;quot; &amp;amp; CStr(oSl.SlideIndex) &amp;amp; vbCrLf _
                    &amp;amp; oSh.TextFrame.TextRange.Text &amp;amp; vbCrLf &amp;amp; vbCrLf
                End If
            End If
        End If
        Next oSh
    Next oSl

    ' now write the text to file
    Open strFileName For Output As intFileNum
    Print #intFileNum, strNotesText
    Close #intFileNum

    ' show what we've done
    lngReturn = Shell(&amp;quot;NOTEPAD.EXE &amp;quot; &amp;amp; strFileName, vbNormalFocus)

End Sub&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/bJgL36q_n2I" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/bJgL36q_n2I/114446b3-f5be-4811-9630-f7e4c3286204.aspx</link>
      <pubDate>Mon, 02 Jan 2012 06:03:04 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/114446b3-f5be-4811-9630-f7e4c3286204.aspx</feedburner:origLink></item>
    <item>
      <title>How to get a list of the slide titles and notes text in PowerPoint?</title>
      <description>Description: Paste all of the code below into a new module and run it to get a listing of the slide titles and notes text in your presentation. This version includes the option to output only entries for slides WITH notes or ALL slides.&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/c9f9875c-aea1-45e5-ae3b-7f4880303b13.aspx'&gt;http://www.codekeep.net/snippets/c9f9875c-aea1-45e5-ae3b-7f4880303b13.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Option Explicit

Dim fOnlyEmptyNotes As Boolean

Sub ExportNotesText()

    Dim oSlides As Slides
    Dim oSl As Slide
    Dim oSh As Shape
    Dim strNotesText As String
    Dim strFileName As String
    Dim intFileNum As Integer
    Dim lngReturn As Long
    Dim results As VbMsgBoxResult
    
    
    ' Get a filename to store the collected text
    strFileName = Replace(ActivePresentation.FullName, &amp;quot;.ppt&amp;quot;, &amp;quot;.txt&amp;quot;)
    strFileName = InputBox(&amp;quot;Enter the full path and name of file to extract notes text to&amp;quot;, &amp;quot;Output file?&amp;quot;, strFileName)
    strNotesText = &amp;quot;Slide Notes from PowerPoint presentation:&amp;quot; &amp;amp; vbCrLf &amp;amp; _
                    ActivePresentation.FullName &amp;amp; vbCrLf &amp;amp; vbCrLf
    
    ' Include only slides with notes in output file?
    results = MsgBox(&amp;quot;Would you like to ONLY include Slides that actually have Notes in your output file?&amp;quot;, _
        vbQuestion + vbYesNoCancel, &amp;quot;Output Results&amp;quot;)
    If results = vbYes Then
        fOnlyEmptyNotes = True
        strNotesText = strNotesText &amp;amp; _
            &amp;quot;IMPORTANT:  This file contains only the slides that have Notes!&amp;quot; &amp;amp; vbCrLf &amp;amp; vbCrLf
    Else
        fOnlyEmptyNotes = False
    End If
    
    

    ' did user cancel?
    If strFileName = &amp;quot;&amp;quot; Or results = vbCancel Then
        Exit Sub
    End If

    ' is the path valid?  crude but effective test:  try to create the file.
    intFileNum = FreeFile()
    On Error Resume Next
    Open strFileName For Output As intFileNum
    If Err.Number &amp;lt;&amp;gt; 0 Then     ' we have a problem
        MsgBox &amp;quot;Couldn't create the file: &amp;quot; &amp;amp; strFileName &amp;amp; vbCrLf _
            &amp;amp; &amp;quot;Please try again.&amp;quot;
        Exit Sub
    End If
    Close #intFileNum  ' temporarily

    ' Get the notes text
    Set oSlides = ActivePresentation.Slides
    
    For Each oSl In oSlides
        If fOnlyEmptyNotes = True Then
            ' Only output notes for slides with actual note text
            If NotesText(oSl) &amp;lt;&amp;gt; vbNullString Then
                strNotesText = strNotesText &amp;amp; &amp;quot;-----------------------------------&amp;quot; &amp;amp; vbCrLf
                strNotesText = strNotesText &amp;amp; &amp;quot;TITLE:  &amp;quot; &amp;amp; SlideTitle(oSl) &amp;amp; vbCrLf
                strNotesText = strNotesText &amp;amp; &amp;quot;NUMBER: &amp;quot; &amp;amp; oSl.SlideNumber &amp;amp; vbCrLf
                strNotesText = strNotesText &amp;amp; &amp;quot;NOTES:  &amp;quot; &amp;amp; NotesText(oSl) &amp;amp; vbCrLf &amp;amp; vbCrLf
            End If
        Else
            ' Output all slides
            strNotesText = strNotesText &amp;amp; &amp;quot;-----------------------------------&amp;quot; &amp;amp; vbCrLf
            strNotesText = strNotesText &amp;amp; &amp;quot;TITLE:  &amp;quot; &amp;amp; SlideTitle(oSl) &amp;amp; vbCrLf
            strNotesText = strNotesText &amp;amp; &amp;quot;NUMBER: &amp;quot; &amp;amp; oSl.SlideNumber &amp;amp; vbCrLf
            strNotesText = strNotesText &amp;amp; &amp;quot;NOTES:  &amp;quot; &amp;amp; NotesText(oSl) &amp;amp; vbCrLf &amp;amp; vbCrLf
        End If
        
    Next oSl

    ' now write the text to file
    Open strFileName For Output As intFileNum
    Print #intFileNum, strNotesText
    Close #intFileNum

    ' show what we've done
    lngReturn = Shell(&amp;quot;NOTEPAD.EXE &amp;quot; &amp;amp; strFileName, vbNormalFocus)

End Sub
Function SlideTitle(oSl As Slide) As String
    Dim oSh As Shape
    For Each oSh In oSl.Shapes
        If oSh.Type = msoPlaceholder Then
            If oSh.PlaceholderFormat.Type = ppPlaceholderTitle _
                Or oSh.PlaceholderFormat.Type = ppPlaceholderCenterTitle Then
                If Len(oSh.TextFrame.TextRange.Text) &amp;gt; 0 Then
                    SlideTitle = oSh.TextFrame.TextRange.Text
                Else
                    SlideTitle = &amp;quot;Slide &amp;quot; &amp;amp; CStr(oSl.SlideIndex)
                End If
                Exit Function
            End If
        End If
    Next
End Function

Function NotesText(oSl As Slide) As String
' Only looking for Shape.Type = PlaceHolder which contains notes
    Dim oSh As Shape
    
    For Each oSh In oSl.NotesPage.Shapes
        If oSh.Type = msoPlaceholder Then
            If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
                If oSh.HasTextFrame Then
                    If oSh.TextFrame.HasText Then
                        NotesText = oSh.TextFrame.TextRange.Text
                    End If
                End If
            Else
                NotesText = vbNullString
            End If
        End If
    Next oSh
    
End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/geg0zwymQHM" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/geg0zwymQHM/c9f9875c-aea1-45e5-ae3b-7f4880303b13.aspx</link>
      <pubDate>Mon, 02 Jan 2012 06:01:56 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/c9f9875c-aea1-45e5-ae3b-7f4880303b13.aspx</feedburner:origLink></item>
    <item>
      <title>Merge text from several text boxes into one text box in Powerpoint</title>
      <description>Description: Merge text from several text boxes into one text box in Powerpoint From PPTools.. not mine.. http://www.pptfaq.com/FAQ00787.htm&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/1e967792-f881-4bf0-af9c-d51250660572.aspx'&gt;http://www.codekeep.net/snippets/1e967792-f881-4bf0-af9c-d51250660572.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub MergeTextBoxes()

' This will merge the text from all selected text boxes into the
' first selected box then delete the other text boxes

' ** PLEASE NOTE this merges the ext in order selected so be careful
' ** About selecting the text in order

    Dim oRng As ShapeRange
    Dim oFirstShape As Shape
    Dim oSh As Shape
    Dim x As Long

    Set oRng = ActiveWindow.Selection.ShapeRange

        Set oFirstShape = oRng(1)
        oFirstShape.TextFrame.TextRange.Text = _
            oFirstShape.TextFrame.TextRange.Text &amp;amp; vbCrLf

    For x = 2 To oRng.Count
        oFirstShape.TextFrame.TextRange.Text = _
            oFirstShape.TextFrame.TextRange.Text _
            &amp;amp; oRng(x).TextFrame.TextRange.Text

        If x &amp;lt; oRng.Count Then

            oFirstShape.TextFrame.TextRange.Text = _
                oFirstShape.TextFrame.TextRange.Text _
                &amp;amp; vbCrLf

        End If

    Next

    For x = oRng.Count To 2 Step -1
        oRng(x).Delete

    Next

    Set oRng = Nothing
    Set oFirstShape = Nothing
    Set oSh = Nothing

End Sub
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/2JLp_Zims5E" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/2JLp_Zims5E/1e967792-f881-4bf0-af9c-d51250660572.aspx</link>
      <pubDate>Mon, 02 Jan 2012 05:55:56 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/1e967792-f881-4bf0-af9c-d51250660572.aspx</feedburner:origLink></item>
    <item>
      <title>Test snipped one here ...</title>
      <description>Description: Test whatever is here&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/fc8a533b-2ef3-402d-85a7-44aad5a2a2a4.aspx'&gt;http://www.codekeep.net/snippets/fc8a533b-2ef3-402d-85a7-44aad5a2a2a4.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;  Dim rgExp As Range: Set rgExp = Range(&amp;quot;B5:H14&amp;quot;)
    
    ''rgExp.CopyPicture Appearance:=xlScreen, Format:=xlPicture
    rgExp.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
    
    With ActiveSheet.ChartObjects.Add(Left:=rgExp.Left, Top:=rgExp.Top, _
                                      Width:=rgExp.Width, Height:=rgExp.Height)
        .Name = &amp;quot;ChartVolumeMetricsDevEXPORT&amp;quot;
        ''.Chart.ChartType = xlColumnStacked
        .Activate
    End With
    ''ActiveSheet.ChartObjects(&amp;quot;ChartVolumeMetricsDevEXPORT&amp;quot;).Activate
    ActiveChart.Paste
    ActiveSheet.ChartObjects(&amp;quot;ChartVolumeMetricsDevEXPORT&amp;quot;).Activate
    ActiveSheet.ChartObjects(&amp;quot;ChartVolumeMetricsDevEXPORT&amp;quot;).Chart.Export &amp;quot;C:\testmeExportChart.jpg&amp;quot;
    ActiveSheet.ChartObjects(&amp;quot;ChartVolumeMetricsDevEXPORT&amp;quot;).Delete
    
    &lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/W4AQZ-JiJgQ" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/W4AQZ-JiJgQ/fc8a533b-2ef3-402d-85a7-44aad5a2a2a4.aspx</link>
      <pubDate>Fri, 13 May 2011 12:03:03 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/fc8a533b-2ef3-402d-85a7-44aad5a2a2a4.aspx</feedburner:origLink></item>
    <item>
      <title>Merge text from several text boxes into one text box in Powerpoint</title>
      <description>Description: Merge text from several text boxes into one text box in Powerpoint

From PPTools.. not mine.. http://www.pptfaq.com/FAQ00787.htm&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/8fd2864e-3a75-48d1-a957-4bd1bf3c57eb.aspx'&gt;http://www.codekeep.net/snippets/8fd2864e-3a75-48d1-a957-4bd1bf3c57eb.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub MergeTextBoxes()

' This will merge the text from all selected text boxes into the
' first selected box then delete the other text boxes

' ** PLEASE NOTE this merges the ext in order selected so be careful
' ** About selecting the text in order

    Dim oRng As ShapeRange
    Dim oFirstShape As Shape
    Dim oSh As Shape
    Dim x As Long

    Set oRng = ActiveWindow.Selection.ShapeRange

        Set oFirstShape = oRng(1)
        oFirstShape.TextFrame.TextRange.Text = _
            oFirstShape.TextFrame.TextRange.Text &amp;amp; vbCrLf

    For x = 2 To oRng.Count
        oFirstShape.TextFrame.TextRange.Text = _
            oFirstShape.TextFrame.TextRange.Text _
            &amp;amp; oRng(x).TextFrame.TextRange.Text

        If x &amp;lt; oRng.Count Then

            oFirstShape.TextFrame.TextRange.Text = _
                oFirstShape.TextFrame.TextRange.Text _
                &amp;amp; vbCrLf

        End If

    Next

    For x = oRng.Count To 2 Step -1
        oRng(x).Delete

    Next

    Set oRng = Nothing
    Set oFirstShape = Nothing
    Set oSh = Nothing

End Sub

&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/5ELEYoO1SWc" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/5ELEYoO1SWc/8fd2864e-3a75-48d1-a957-4bd1bf3c57eb.aspx</link>
      <pubDate>Mon, 17 Jan 2011 11:24:38 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/8fd2864e-3a75-48d1-a957-4bd1bf3c57eb.aspx</feedburner:origLink></item>
    <item>
      <title>Export Active Chart in Excel as PNG</title>
      <description>Description: Export Active Chart in Excel as PNG to C:/&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/51082732-95bf-4d24-9e4f-8f75c05ac815.aspx'&gt;http://www.codekeep.net/snippets/51082732-95bf-4d24-9e4f-8f75c05ac815.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub Save_ChartAsImage()

Dim oCht As Chart
Set oCht = ActiveChart
On erRROR GoTo Err_Chart

     oCht.Export Filename:=&amp;quot;C:\ExcelExport.png&amp;quot;, Filtername:=&amp;quot;png&amp;quot;

Err_Chart:
If Err &amp;lt;&amp;gt; 0 Then
     Debug.Print Err.Description
Err.Clear
End If

End Sub


&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/AycD4yQjtco" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/AycD4yQjtco/51082732-95bf-4d24-9e4f-8f75c05ac815.aspx</link>
      <pubDate>Mon, 17 Jan 2011 11:18:04 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/51082732-95bf-4d24-9e4f-8f75c05ac815.aspx</feedburner:origLink></item>
    <item>
      <title>Excel ADO -  Get Data from SQL Server</title>
      <description>Description: Excel ADO -  Get Data from SQL Server&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/ae22081d-8809-493b-9457-730c307042a0.aspx'&gt;http://www.codekeep.net/snippets/ae22081d-8809-493b-9457-730c307042a0.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub GetManagerEmployeeListSQL()

    Dim cnn As ADODB.Connection
    Dim cmd As ADODB.Command
    Dim param As ADODB.Parameter
    Dim rs As ADODB.Recordset
    Dim sConnString As String
    Dim i As Integer
    
    Dim xlSheet As Worksheet
    
    Set xlSheet = Sheets(&amp;quot;Sheet1&amp;quot;)
    xlSheet.Activate
    Range(&amp;quot;A3&amp;quot;).Activate
    Selection.CurrentRegion.Select
    Selection.ClearContents
    Range(&amp;quot;A1&amp;quot;).Select
    
    Set cnn = New ADODB.Connection
    sConnString = &amp;quot;Provider=SQLNCLI10;Server=XPS8300;Database=AdventureWorks2008R2;Trusted_Connection=yes;&amp;quot;
    cnn.Open sConnString
    
    Set cmd = New ADODB.Command
    cmd.ActiveConnection = cnn
    
    Set param = New ADODB.Parameter
    With param
        .Name = &amp;quot;BusinessEntityID&amp;quot;
        .Type = adInteger
        .Value = ActiveSheet.Range(&amp;quot;A1&amp;quot;).Value
    End With
    
    With cmd
        .CommandType = adCmdStoredProc
        .CommandText = &amp;quot;uspGetManagerEmployees&amp;quot;
        .Parameters.Append param
    End With
    
    Set rs = New ADODB.Recordset
    Set rs = cmd.Execute
    
    For i = 1 To rs.Fields.Count
        ActiveSheet.Cells(3, i).Value = rs.Fields(i - 1).Name
    Next i
    
    xlSheet.Range(&amp;quot;A4&amp;quot;).CopyFromRecordset rs
    
    xlSheet.Select
    Range(&amp;quot;A3&amp;quot;).Select
    Selection.CurrentRegion.Select
    Selection.Columns.AutoFit
    Range(&amp;quot;A1&amp;quot;).Select
    
    rs.Close
    cnn.Close
    Set cmd = Nothing
    Set param = Nothing
    Set rs = Nothing
    Set cnn = Nothing
    Set xlSheet = Nothing
    

End Sub&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/n_DRx7hyME8" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/n_DRx7hyME8/ae22081d-8809-493b-9457-730c307042a0.aspx</link>
      <pubDate>Tue, 28 Sep 2010 13:39:33 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/ae22081d-8809-493b-9457-730c307042a0.aspx</feedburner:origLink></item>
    <item>
      <title>DuplicateRecord</title>
      <description>Description: Create a new record in Access that has data identical to a selected record. &lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/3a8226eb-bc6a-4fb5-abb6-aa68216f2e94.aspx'&gt;http://www.codekeep.net/snippets/3a8226eb-bc6a-4fb5-abb6-aa68216f2e94.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function DuplicateRecord(tblName As String, AutoGenID As String, AutoGenValue As Integer) As Long

Dim rRst As Recordset
Dim fFld As Field
Dim lFieldCounter As Long
Dim sFind As String

On Error GoTo Error_Handler

Set rRst = CurrentDb.OpenRecordset(tblName, dbOpenDynaset)
sFind = &amp;quot;[&amp;quot; &amp;amp; AutoGenID &amp;amp; &amp;quot;]=&amp;quot; &amp;amp; AutoGenValue

lFieldCounter = 0

With rRst
.FindFirst sFind
ReDim sArrayFieldName(.Fields.Count) As String
ReDim vArrayFieldValue(.Fields.Count) As Variant

For Each fFld In .Fields
    lFieldCounter = lFieldCounter + 1
    sArrayFieldName(lFieldCounter) = fFld.Name
    vArrayFieldValue(lFieldCounter) = Nz(fFld.Value, fFld.DefaultValue)
    If vArrayFieldValue(lFieldCounter) = &amp;quot;&amp;quot; Then vArrayFieldValue(lFieldCounter) = &amp;quot;IGNORETHISVALUE&amp;quot;
    
Next fFld

lFieldCounter = 0
.AddNew
For Each fFld In .Fields
lFieldCounter = lFieldCounter + 1
If .Fields(sArrayFieldName(lFieldCounter)).Name &amp;lt;&amp;gt; AutoGenID Then
If vArrayFieldValue(lFieldCounter) &amp;lt;&amp;gt; &amp;quot;IGNORETHISVALUE&amp;quot; Then _
.Fields(sArrayFieldName(lFieldCounter)) = vArrayFieldValue(lFieldCounter)
End If

Next fFld

.Update
.Bookmark = .LastModified
DuplicateRecord = .Fields(AutoGenID)
End With

ExitFunction:
Exit Function

Error_Handler:

Select Case Err.Number
    Case 3022
        Resume Next
    Case Else
        MsgBox Err.Description &amp;amp; &amp;quot; (&amp;quot; &amp;amp; Err.Number &amp;amp; &amp;quot;)&amp;quot;
End Select

End Function
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/3gxM9AGfAD0" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/3gxM9AGfAD0/3a8226eb-bc6a-4fb5-abb6-aa68216f2e94.aspx</link>
      <pubDate>Mon, 24 May 2010 10:54:13 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/3a8226eb-bc6a-4fb5-abb6-aa68216f2e94.aspx</feedburner:origLink></item>
    <item>
      <title>ChartList v2</title>
      <description>Description: Get complete list of charts, the sheet they are on and their index number on a seperate sheet&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/a18d2fd8-902e-4a3b-a90f-ccc4bb618db7.aspx'&gt;http://www.codekeep.net/snippets/a18d2fd8-902e-4a3b-a90f-ccc4bb618db7.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Public Sub chart_list()
Dim oChtobj As ChartObject
Dim oWsht As Worksheet
Dim iRange As Integer
Dim iList As Integer
Dim iCount As Integer

On Error Resume Next

Application.ScreenUpdating = False
iCount = 0
'Create Chart List Sheet (only create if not existent)
For Each oWsht In Sheets
    If oWsht.Name = &amp;quot;FRS Chart List&amp;quot; Then
        Application.DisplayAlerts = False
            oWsht.Delete
        Application.DisplayAlerts = True
    End If
    iCount = iCount + oWsht.ChartObjects.Count
Next oWsht

Sheets.Add.Name = &amp;quot;Chart List (SJM &amp;#169;)&amp;quot;

ReDim sArraysheet(iCount) As String
ReDim sArraychart(iCount) As String
ReDim sArrayindex(iCount) As String
ReDim sArrayRangeString(iCount) As Integer
ReDim sArrayIsEmpty(iCount) As String

'Collect the chart info
For Each oWsht In Sheets
    If oWsht.Name = &amp;quot;Chart List (SJM &amp;#169;)&amp;quot; Then GoTo SkipSheet
        For Each oChtobj In oWsht.ChartObjects
            sArraysheet(iList) = oWsht.Name
            sArraychart(iList) = oChtobj.Name
            sArrayindex(iList) = oChtobj.index
            sArrayRangeString(iList) = oChtobj.Chart.SeriesCollection.Count
            If sArrayRangeString(iList) = 0 Then sArrayIsEmpty(iList) = &amp;quot;Yes&amp;quot;
            iList = iList + 1
        Next oChtobj
SkipSheet:
Next oWsht

'Write to the new Sheet
Worksheets(&amp;quot;Chart List (SJM &amp;#169;)&amp;quot;).Activate

With Range(&amp;quot;A1&amp;quot;)
.Value = &amp;quot;List of Chart Objects in this Workbook&amp;quot;
.Font.Bold = True
.ColumnWidth = 35
End With

With Range(&amp;quot;A2&amp;quot;)
.Value = &amp;quot;Sheet Name&amp;quot;
.Font.Color = vbRed
End With

With Range(&amp;quot;B1&amp;quot;)
.Value = &amp;quot;Total Charts: &amp;quot; &amp;amp; iCount
.ColumnWidth = 15
End With

With Range(&amp;quot;B2&amp;quot;)
.Value = &amp;quot;Chart Name&amp;quot;
.Font.Color = vbRed
End With

With Range(&amp;quot;C2&amp;quot;)
.ColumnWidth = 11
.Value = &amp;quot;Chart Index&amp;quot;
.Font.Color = vbRed
End With

With Range(&amp;quot;D2&amp;quot;)
.Value = &amp;quot;Empty Chart?&amp;quot;
.Font.Color = vbRed
.ColumnWidth = 17
End With

iRange = 3

For iList = LBound(sArraysheet) To UBound(sArraysheet)
    Cells(iRange, 1).Value = sArraysheet(iList)
    Cells(iRange, 2).Value = sArraychart(iList)
    Cells(iRange, 3).Value = sArrayindex(iList)
    Cells(iRange, 4).Value = sArrayIsEmpty(iList)
    iRange = iRange + 1
Next iList


Range(&amp;quot;A3:D9999&amp;quot;).Select
    Selection.Sort Key1:=Range(&amp;quot;B2&amp;quot;), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
    
Cells(3, 1).Select
ActiveWindow.FreezePanes = True

Application.ScreenUpdating = True

End Sub&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/p2q80vBfobI" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/p2q80vBfobI/a18d2fd8-902e-4a3b-a90f-ccc4bb618db7.aspx</link>
      <pubDate>Fri, 07 May 2010 10:39:21 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/a18d2fd8-902e-4a3b-a90f-ccc4bb618db7.aspx</feedburner:origLink></item>
    <item>
      <title>Turning Alerts off on screen </title>
      <description>Description: Title says it all &lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/b959df05-e3e0-4b03-8617-5b9d8d2bf93a.aspx'&gt;http://www.codekeep.net/snippets/b959df05-e3e0-4b03-8617-5b9d8d2bf93a.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;
            Application.DisplayAlerts = False 
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/I3BXhSh8QLw" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/I3BXhSh8QLw/b959df05-e3e0-4b03-8617-5b9d8d2bf93a.aspx</link>
      <pubDate>Thu, 06 May 2010 04:03:31 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/b959df05-e3e0-4b03-8617-5b9d8d2bf93a.aspx</feedburner:origLink></item>
    <item>
      <title>Screen Select</title>
      <description>Description: Selecting all that is shown on the screen , plus some tweaks&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/d014f305-c822-421e-83c7-9124dbeafd8f.aspx'&gt;http://www.codekeep.net/snippets/d014f305-c822-421e-83c7-9124dbeafd8f.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;This can be used in excel to select all that is there on screen 


Activesheet.usedrange.select

Modified code about this , that is letting go of the header &amp;amp; then deleteting them , to select instead of rows.delete write select

 
Application.DisplayAlerts = false ' as it would ask you whether you wanna delete
ActiveSheet.UsedRange.Offset(1, 0).Resize(ActiveSheet.UsedRange.Rows.Count - 1).Rows.Delete
            Application.DisplayAlerts = True&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/flJBVR6iwzk" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/flJBVR6iwzk/d014f305-c822-421e-83c7-9124dbeafd8f.aspx</link>
      <pubDate>Thu, 06 May 2010 04:02:45 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/d014f305-c822-421e-83c7-9124dbeafd8f.aspx</feedburner:origLink></item>
    <item>
      <title>Create charts</title>
      <description>Description: Charting values from particular sheets&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/c6c824f2-0398-4b1e-8d0a-10069ec74917.aspx'&gt;http://www.codekeep.net/snippets/c6c824f2-0398-4b1e-8d0a-10069ec74917.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub CreateChart()
Dim ChartObj As ChartObject
Dim ChartSeries As Series, chartseries2 As Series, c3 As Series, c4 As Series, c5 As Series, c6 As Series, c7 As Series



For I = 3 To 10 ' dis allows me to run the loop however I want 


Sheets(I).Select 

'Deleteing older charts ,if you had like
'On Error Resume Next
'ActiveSheet.ChartObjects(&amp;quot;PRASHANT&amp;quot;).Delete




Set ChartObj = ActiveSheet.ChartObjects.Add(Left:=100, Width:=550, Top:=75, Height:=325)

Set ChartSeries = ChartObj.Chart.SeriesCollection.NewSeries
ChartObj.Chart.ChartType = 4
ChartObj.Name = &amp;quot;PRASHANT&amp;quot;


With ChartSeries
            .Name = &amp;quot;UB&amp;quot;
            .Values = ActiveSheet.Range(&amp;quot;i3:i393&amp;quot;)
 End With
 
 Set chartseries2 = ChartObj.Chart.SeriesCollection.NewSeries

 With chartseries2
            .Name = &amp;quot;LB1&amp;quot;
            .Values = ActiveSheet.Range(&amp;quot;h3:h393&amp;quot;)
            
 End With
 
 
Set c3 = ChartObj.Chart.SeriesCollection.NewSeries
With c3
    .Name = &amp;quot;UB1&amp;quot;
    .Values = ActiveSheet.Range(&amp;quot;j3:j393&amp;quot;)
    
End With



Next

End Sub&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/rpSfMYBrvYU" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/rpSfMYBrvYU/c6c824f2-0398-4b1e-8d0a-10069ec74917.aspx</link>
      <pubDate>Tue, 04 May 2010 03:10:12 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/c6c824f2-0398-4b1e-8d0a-10069ec74917.aspx</feedburner:origLink></item>
    <item>
      <title>Copying ranges from 1 sheet to another</title>
      <description>Description: No macro&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/21dcef17-6acb-40ee-8756-6906ac4e4d45.aspx'&gt;http://www.codekeep.net/snippets/21dcef17-6acb-40ee-8756-6906ac4e4d45.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;

range(&amp;quot;a2:j2&amp;quot;).value = sheets(&amp;quot;abc&amp;quot;).range(&amp;quot;__&amp;quot;).value

Offset can be integrated


I can use the formula as well by substituting value with formula that works fine as well. 

&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/PM90H8saCUA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/PM90H8saCUA/21dcef17-6acb-40ee-8756-6906ac4e4d45.aspx</link>
      <pubDate>Tue, 04 May 2010 03:05:02 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/21dcef17-6acb-40ee-8756-6906ac4e4d45.aspx</feedburner:origLink></item>
    <item>
      <title>ReturnTabName</title>
      <description>Description: Retrieve the current tab name in the Pages collection (Microsoft Access)&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/223b666a-7915-4ad4-81e4-879c4968e006.aspx'&gt;http://www.codekeep.net/snippets/223b666a-7915-4ad4-81e4-879c4968e006.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function ReturnTabName(frm As Form, TabControlName As String) As String
ReturnTabName = frm(TabControlName).Pages(frm(TabControlName)).Name
End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/E0uLuJXtxYo" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/E0uLuJXtxYo/223b666a-7915-4ad4-81e4-879c4968e006.aspx</link>
      <pubDate>Wed, 28 Apr 2010 06:22:23 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/223b666a-7915-4ad4-81e4-879c4968e006.aspx</feedburner:origLink></item>
    <item>
      <title>Copying a Column value Smarter way </title>
      <description>Description: Using vba to copy and paste ranges &amp; Columns&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/39ab9455-57cb-4bbb-bb94-9f28924fb2c7.aspx'&gt;http://www.codekeep.net/snippets/39ab9455-57cb-4bbb-bb94-9f28924fb2c7.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;
Sheets(&amp;quot;V9&amp;quot;).Columns(&amp;quot;A:D&amp;quot;).Value = Sheets(&amp;quot;RawData&amp;quot;).Columns(&amp;quot;F:I&amp;quot;).Value
 

See the smart part , it's opposite of the copy command which requires me type 
the source before and don't give me values&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/g8CbwJGd_M0" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/g8CbwJGd_M0/39ab9455-57cb-4bbb-bb94-9f28924fb2c7.aspx</link>
      <pubDate>Thu, 22 Apr 2010 07:07:30 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/39ab9455-57cb-4bbb-bb94-9f28924fb2c7.aspx</feedburner:origLink></item>
    <item>
      <title>Dynamic Array Size &amp; Transpose</title>
      <description>Description: Dynamic Array - Redefining it's size with redim and transposing it &lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/42fc8c6a-43c5-47a0-a1b3-54714724ce48.aspx'&gt;http://www.codekeep.net/snippets/42fc8c6a-43c5-47a0-a1b3-54714724ce48.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Sub opportunity()
Dim opp() As Integer
Dim trades As Integer ' we define the trades we can take on basis of fv
Dim i As Integer


trades = 0

lastrow = Range(&amp;quot;x2&amp;quot;).End(xlDown).Row 

upbounx = 1 

ReDim opp(1 To lastrow)

For i = 1 To lastrow

opp(i) = Range(&amp;quot;x1&amp;quot;).Offset(i, 0) - upbound

Next

Range(&amp;quot;aa2:aa&amp;quot; &amp;amp; lastrow) = WorksheetFunction.Transpose(opp)

End Sub
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/XFVHJwUa1HA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/XFVHJwUa1HA/42fc8c6a-43c5-47a0-a1b3-54714724ce48.aspx</link>
      <pubDate>Thu, 22 Apr 2010 06:49:02 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/42fc8c6a-43c5-47a0-a1b3-54714724ce48.aspx</feedburner:origLink></item>
    <item>
      <title>Excel Transpose</title>
      <description>Description: How to print your Array your created&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/1f026b9e-a550-4d6e-aa59-be350f1608f2.aspx'&gt;http://www.codekeep.net/snippets/1f026b9e-a550-4d6e-aa59-be350f1608f2.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Range(&amp;quot;aa2:aa20&amp;quot;) = WorksheetFunction.Transpose(opp)


Here opp() is my array of 20 objects

To make it little bit dynamic I can define last row variable by 

lastrow = a2.end(xldown).row



&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/0bwBxOpZ1b4" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/0bwBxOpZ1b4/1f026b9e-a550-4d6e-aa59-be350f1608f2.aspx</link>
      <pubDate>Thu, 22 Apr 2010 06:46:24 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/1f026b9e-a550-4d6e-aa59-be350f1608f2.aspx</feedburner:origLink></item>
    <item>
      <title>Excel Autofill</title>
      <description>Description: Autofill by &amp; Numberformat
&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/a40368dc-d57c-4564-b4ca-e34f5dc184f3.aspx'&gt;http://www.codekeep.net/snippets/a40368dc-d57c-4564-b4ca-e34f5dc184f3.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Range(&amp;quot;a5&amp;quot;).Copy Range(&amp;quot;e5&amp;quot;)

Range(&amp;quot;e5&amp;quot;).AutoFill Range(&amp;quot;e5:e&amp;quot; &amp;amp; lrow), xlFillDefault
Columns(&amp;quot;E:E&amp;quot;).NumberFormat = &amp;quot;DDDD&amp;quot; ' dis converts the number format to days


Also a good thing to see here is that in part II , e5 is going to be used,
as we can only drag that part ddown 


Range(&amp;quot;e5:i5&amp;quot;).autofill range(&amp;quot;e5:i233&amp;quot;) , this will autofill till i233



Other Options

   xlFillDefault = 0 
   xlFillCopy = 1 
   xlFillSeries = 2 
   xlFillFormats = 3 
   xlFillValues = 4 
   xlFillDays = 5 
   xlFillWeekdays = 6 
   xlFillMonths = 7 
   xlFillYears = 8 
   xlLinearTrend = 9 
   xlGrowthTrend = 10 
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/S6nIjE9Gs6E" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/S6nIjE9Gs6E/a40368dc-d57c-4564-b4ca-e34f5dc184f3.aspx</link>
      <pubDate>Thu, 22 Apr 2010 04:50:46 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/a40368dc-d57c-4564-b4ca-e34f5dc184f3.aspx</feedburner:origLink></item>
    <item>
      <title>Excel</title>
      <description>Description: Going to the last row&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/e51ba2b6-f4ec-4c0f-a0ee-2a88167a7532.aspx'&gt;http://www.codekeep.net/snippets/e51ba2b6-f4ec-4c0f-a0ee-2a88167a7532.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;
Dim lrow As Long

lrow = Cells(Rows.Count, 2).End(xlUp).Row


&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/utNFx9FdDKs" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/utNFx9FdDKs/e51ba2b6-f4ec-4c0f-a0ee-2a88167a7532.aspx</link>
      <pubDate>Thu, 22 Apr 2010 04:48:33 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/e51ba2b6-f4ec-4c0f-a0ee-2a88167a7532.aspx</feedburner:origLink></item>
    <item>
      <title>FormatAddress</title>
      <description>Description: 
Turn an address string into a properly formatted address block&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/ef5258c4-d40b-462b-aa27-6e75ed88fc49.aspx'&gt;http://www.codekeep.net/snippets/ef5258c4-d40b-462b-aa27-6e75ed88fc49.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function FormatAddress(AddressIn As String, _
DelimiterUsed As String) As String

Dim sAddress As String
Dim i As Integer
sAddress = AddressIn

While InStr(1, sAddress, DelimiterUsed &amp;amp; Space(1)) &amp;gt; 0 Or InStr(1, sAddress, Space(1) &amp;amp; DelimiterUsed) &amp;gt; 0
    sAddress = Replace(sAddress, DelimiterUsed &amp;amp; Space(1), DelimiterUsed)
    sAddress = Replace(sAddress, Space(1) &amp;amp; DelimiterUsed, DelimiterUsed)
Wend


FormatAddress = Replace(sAddress, DelimiterUsed, vbNewLine)

End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/OQaV3-gx15Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/OQaV3-gx15Q/ef5258c4-d40b-462b-aa27-6e75ed88fc49.aspx</link>
      <pubDate>Tue, 20 Apr 2010 06:44:41 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/ef5258c4-d40b-462b-aa27-6e75ed88fc49.aspx</feedburner:origLink></item>
    <item>
      <title>HighlightRecord</title>
      <description>Description: Highlight a record in Microsoft Access&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/7d83787e-1be0-4cf9-87ec-2b72f350e403.aspx'&gt;http://www.codekeep.net/snippets/7d83787e-1be0-4cf9-87ec-2b72f350e403.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function HighlightRecord(frm As Form, ctl As Control)
Dim sName As String
sName = ctl.Name

frm.TextHighlight.ControlSource = _
&amp;quot;=iif([&amp;quot; &amp;amp; sName &amp;amp; &amp;quot;]='&amp;quot; &amp;amp; ctl.Value &amp;amp; &amp;quot;','Yes','No')&amp;quot;

End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/BjBXob3nay8" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/BjBXob3nay8/7d83787e-1be0-4cf9-87ec-2b72f350e403.aspx</link>
      <pubDate>Fri, 16 Apr 2010 08:19:41 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/7d83787e-1be0-4cf9-87ec-2b72f350e403.aspx</feedburner:origLink></item>
    <item>
      <title>LastnMax</title>
      <description>Description: Excel VBA to  retrieve a maximum value from previous &lt;n&gt; rows. Can be used to return the value within VBA or as a UDF&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/565cebd9-d5dd-477e-8dd2-d521d2ca6002.aspx'&gt;http://www.codekeep.net/snippets/565cebd9-d5dd-477e-8dd2-d521d2ca6002.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function LastnMax(sWorkSheet As String, sColumn As String, RowsToOffset) As Variant

Application.Volatile True

Dim rLastRow As Integer
'Find the last used row in the chosen sheet and column (actual)
rLastRow = Worksheets(sWorkSheet).Range(sColumn &amp;amp; Worksheets(sWorkSheet).Rows.Count).End(xlUp).Row

With Worksheets(sWorkSheet)
'If there is a function to cause the cell contents to be blank loop upwards, past these
While .Cells(rLastRow, sColumn).Value = &amp;quot;&amp;quot; Or .Cells(rLastRow, sColumn).Value = 0
    rLastRow = .Cells(rLastRow, sColumn).Offset(-1, 0).Row
Wend

'Finally, work out the maximum value in a range count of &amp;lt;n&amp;gt;(last &amp;lt;n&amp;gt; entries in other words)
    LastnMax = WorksheetFunction.Max(.Range( _
    .Cells(rLastRow, sColumn).Offset(-RowsToOffSet, 0).Address, _
    .Cells(rLastRow, sColumn).Address))
    
End With

End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/BIYI_ieI1kA" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/BIYI_ieI1kA/565cebd9-d5dd-477e-8dd2-d521d2ca6002.aspx</link>
      <pubDate>Thu, 15 Apr 2010 06:57:01 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/565cebd9-d5dd-477e-8dd2-d521d2ca6002.aspx</feedburner:origLink></item>
    <item>
      <title>Arg_Section</title>
      <description>Description: Retrieves a single string value from a long string with uniform delimiters based on a section number in the codes argument.&lt;br /&gt;&lt;br /&gt;Link: &lt;a href='http://www.codekeep.net/snippets/6c3485e4-400a-4f60-8340-1e534957b02d.aspx'&gt;http://www.codekeep.net/snippets/6c3485e4-400a-4f60-8340-1e534957b02d.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style='font-size: 9pt;'&gt;Function Arg_Section(WholeString As String, SectionNumber As Integer, _
DelimiterChar As String) As String
' Steve Moore
' 24/04/04
' Returns a string from a given section (index)within a larger delimited string
' Usage: varString=Arg_Section(Delimited String, Required Section Number FROM String, Delimiter)
'

On Error Resume Next

Dim IntSectionStart As Integer
Dim IntSectionEnd As Integer
Dim DblStringLength As Double
Dim i As Integer
Dim IntDelim1Loc As Integer
Dim IntDelim2Loc As Integer
Dim IntDelimLocation As Integer
Dim IntStringLoc As Integer
Dim pWholeString As String
pWholeString = WholeString
pWholeString = DelimiterChar &amp;amp; pWholeString &amp;amp; DelimiterChar

DblStringLength = Len(pWholeString) 'Find the length of the passed, delimited string
IntDelim1Loc = SectionNumber - 1 'Number of leading delimiter
IntDelim2Loc = SectionNumber 'Number of trailing delimiter
IntDelimLocation = IntDelim1Loc 'Store 1st position number to general variable

Examine_Delim:
IntStringLoc = 1 'Beginning location in string

For i = 0 To IntDelimLocation

IntStringLoc = InStr(IntStringLoc, pWholeString, DelimiterChar)
IntStringLoc = IntStringLoc + 1

Next i

If IntDelimLocation = IntDelim1Loc Then
    IntSectionStart = IntStringLoc
    IntDelimLocation = IntDelim2Loc
    GoTo Examine_Delim
End If

If IntDelimLocation = IntDelim2Loc Then
    IntSectionEnd = IntStringLoc - 1
End If

Arg_Section = Mid(pWholeString, IntSectionStart, (IntSectionEnd - IntSectionStart))

End Function&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeKeepVBA/~4/wjthRW77M1Q" height="1" width="1"/&gt;</description>
      <link>http://feedproxy.google.com/~r/CodeKeepVBA/~3/wjthRW77M1Q/6c3485e4-400a-4f60-8340-1e534957b02d.aspx</link>
      <pubDate>Thu, 15 Apr 2010 06:36:46 GMT</pubDate>
    <feedburner:origLink>http://www.codekeep.net/snippets/6c3485e4-400a-4f60-8340-1e534957b02d.aspx</feedburner:origLink></item>
  </channel>
</rss>
