Option Explicit Sub MarkCells() 'David McRitchie 1998/07/17 [Mark cells with cell address] Documented 'with Join() in http://www.mvps.org/dmcritchie/excel/excel.htm Dim iAnswer As Long If Selection.Count > 1000 Then iAnswer = MsgBox("Over 1000 items, you have " _ & Format(Selection.Count, "#,###") & " items in " _ & Selection.Areas.Count _ & " areas, estimated time to complete is " _ & Format(Selection.Count * 0.00058333 + 0.05, _ "#,###.#") & " minutes", _ vbOKCancel + vbExclamation + vbDefaultButton2, "Proceed or Not") If iAnswer = 2 Then Exit Sub End If Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim cell As Range For Each cell In Selection cell.Value = "'" & cell.AddressLocal(0, 0) Next cell If Application.EnableEvents = False Then MsgBox "EnableEvents was False -- resetting to True" Application.EnableEvents = True End If Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub Sub MarkSepAreas() 'David McRitchie extension of MarkCells to handle multiple areas 'based on Alan Beban code - Jun 3, 1999 microsoft.public.excel.programming Dim iAnswer As Long If Selection.Count > 1000 Then iAnswer = MsgBox("Over 1000 items, you have " _ & Format(Selection.Count, "#,###") & " items in " _ & Selection.Areas.Count _ & " areas, estimated time to complete is " _ & Format(Selection.Count * 0.00058333 + 0.05, _ "#,###.#") & " minutes", _ vbOKCancel + vbExclamation + vbDefaultButton2, "Proceed or Not") If iAnswer = 2 Then Exit Sub End If Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim i As Long, j As Long Application.DisplayStatusBar = True Application.StatusBar = "areas=" & Selection.Areas.Count For i = 1 To Selection.Areas.Count For j = 1 To Selection.Areas(i).Count Selection.Areas(i)(j).Value = "'" & _ Selection.Areas(i)(j).AddressLocal(0, 0) & "-" & i Next Next Application.StatusBar = "Ready" Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub Sub MarkSeq() 'David McRitchie 2002/08/07 [Mark cells with Sequence number] Documented 'with Join() in http://www.mvps.org/dmcritchie/excel/excel.htm Dim iAnswer As Long If Selection.Count > 1000 Then iAnswer = MsgBox("Over 1000 items, you have " _ & Selection.Count & " items, estimated time to complete is " _ & Format(Selection.Count * 0.00058333 + 0.05, _ "#,# items##.#") & " minutes", vbOKCancel, "Proceed or Not") If iAnswer = 2 Then Exit Sub End If Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim cell As Range, iPos As Long Dim prefix As String, suffix As String, cSeq As Long, iStr As String cSeq = 0 iStr = InputBox("Supply prefix/suffix strings", "prefix/suffix", "/") If iStr = "" Or iStr = "/" Then Else iPos = InStr(1, iStr, "/") If iPos = 0 Then prefix = iStr Else prefix = Left(iStr, iPos - 1) suffix = Mid(iStr, iPos + 1) End If End If For Each cell In Selection cSeq = cSeq + 1 cell.Value = prefix & cSeq & suffix Next cell Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub Sub RandomAZ() 'David McRitchie 2002-01-04 Dim cell As Range Randomize ' Initialize random-number generator. Dim MaxLetter As Long MaxLetter = 8 For Each cell In Selection cell.Value = Chr(Int((MaxLetter * Rnd) + 1) + 64) ' Generate random value between 1 and Maxletter. Next cell End Sub Sub Random003() 'David McRitchie 2002-08-02 Dim cell As Range Randomize ' Initialize random-number generator. For Each cell In Selection cell.Value = Int(Rnd * 100) Next cell End Sub Sub suffix() 'David McRitchie 2002-07-22 [Mark cells with cell address] Related to 'with Join() in http://www.mvps.org/dmcritchie/excel/excel.htm Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Dim sfxValue As String, cell As Range sfxValue = InputBox("Supply Suffix for selected range," & Chr(10) _ & "The Default will be two spaces", "Supply Suffix", " ") For Each cell In Selection cell.Value = cell.Value & sfxValue Next cell Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True End Sub