Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

BASE tag insertion macro

// BASE tag insertion macro
How to get Ativan prescribed for you. Ativan buy in UK. Ativan cod. Medicine online Valium. Buy Valium paypal. Valium online medication.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Insert a BASE HREF tag just after the head tag of an HTML document
;; Positions point just after the second forwardslash in "HTTP://"

(fset 'insert-base-href
   [?\M-< ?\C-s ?< ?h ?e ?a ?d ?\C-e return return return up ?< ?b ?a ?s ?e ?  ?h ?r ?e ?f ?= ?" ?h ?t ?t ?p ?: ?/ ?/ ?" ?> left left])

Phentermine overnight delivery saturday. No prescriptions needed for Phentermine. Pr Order Amoxicillin cash on delivery. Amoxicillin no script. Amoxicillin cash on deliv

Excel VBA :: Auto Index

//As per http://www.ozgrid.com/VBA/sheet-index.htm
//Use this macro to automatically generate an index of all worksheets in the workbook everytime you click on the Index tab

Private Sub Worksheet_Activate()
Dim wSheet As Worksheet
Dim l As Long

l = 1

    With Me
        .Columns(1).ClearContents
        .Cells(1, 1) = "INDEX"
        .Cells(1, 1).Name = "Index"
    End With
    

    For Each wSheet In Worksheets
        If wSheet.Name <> Me.Name Then
            l = l + 1
                With wSheet
                    .Range("A1").Name = "Start_" & wSheet.Index
                    .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _
                    SubAddress:="Index", TextToDisplay:="Back to Index"
                End With

                Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", _
                SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name
        End If
    Next wSheet

End Sub

Excel Macro :: Sort Tabs

//Excel Macro :: Sort Tabs as per http://www.ozgrid.com/VBA/sort-sheets.htm

Sub SortSheets()

Dim lCount As Long, lCounted As Long

Dim lShtLast As Long

Dim lReply As Long





lReply = MsgBox("To sort Worksheets ascending, select 'Yes'. "&"To sort Worksheets descending select 'No'", vbYesNoCancel, "Ozgrid Sheet Sort")

If lReply = vbCancel Then Exit Sub



lShtLast = Sheets.Count



    If lReply = vbYes Then 'Sort ascending

        For lCount = 1 To lShtLast

            For lCount2 = lCount To lShtLast

                If UCase(Sheets(lCount2).Name) < UCase(Sheets(lCount).Name) Then

                    Sheets(lCount2).Move Before:=Sheets(lCount)

                End If

            Next lCount2

        Next lCount

    Else 'Sort descending

     For lCount = 1 To lShtLast

            For lCount2 = lCount To lShtLast

                If UCase(Sheets(lCount2).Name) > UCase(Sheets(lCount).Name) Then

                    Sheets(lCount2).Move Before:=Sheets(lCount)

                End If

            Next lCount2

        Next lCount

    End If



End Sub

BASE tag insertion macro

// BASE tag insertion macro
Fioricet with codeine to buy. Fioricet for migraines delivery to US Massachusetts. Bu Buy Soma online with overnight delivery. Cheap order prescription Soma 30mg. Soma for
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Insert a BASE HREF tag just after the head tag of an HTML document
;; Positions point just after the second forwardslash in "HTTP://"

(fset 'insert-base-href
   [?\M-< ?\C-s ?< ?h ?e ?a ?d ?\C-e return return return up ?< ?b ?a ?s ?e ?  ?h ?r ?e ?f ?= ?" ?h ?t ?t ?p ?: ?/ ?/ ?" ?> left left])

Xanax bars delivery to US Florida. Purchase Xanax COD. Xanax 1 mg online no perscript Lorazepam ativan cheap fed ex delivery. Lorazepam 2mg shipped c.o.d. Apo-lorazepam an

C macro that implements count_if, sum, max_elem

// C macro that does count_if, sum, max_elem.

#define COUNT_IF(ITERATION, CONDITION, COUNT)  {COUNT =0; ITERATION {if(CONDITION) COUNT++;}}  
/* ex: COUNT_IF( for(i=0;i++;i<10), i%2==0, evens)  [counting the number of evens.]  */

#define SUM(ITERATION, EXPRESSION, SUMM)  {SUMM =0; ITERATION {SUMM +=(EXPRESSION);}}  
/* if ITERATION is an empty iteration, the sum is 0
SUM( for(i=0;i<60;i++) if(zik[i]==sol[i]) , score[i], actual_score ) */


#define MAX_ELEM(ITERATION, EXPRESSION, MAX_VALUE, POSITION)  { \
	bool first233496 = true;                                   \
	ITERATION {                                               \
		if(first233496){ first233496 = false; POSITION ; MAX_VALUE =(EXPRESSION); } \
		else if((EXPRESSION)> MAX_VALUE ){ POSITION ; MAX_VALUE =(EXPRESSION); }   \
	}                                               \
}
/* if ITERATION is an empty iteration, this macro does not work.
ex: MAX_ELEM(for(x=0;x<5;x++) for(y=0;y<5;y++) , x-2*y , maximum , {m_x=x;m_y=y;} );  [ Set (m_x,m_y,maximum) := (x,y,x-2*y) when x-2*y achieves maximum value] 
ex: MAX_ELEM( ON(i,10), (10-v[i])*v[i], d, k=i); */