Professional Documents
Culture Documents
H="Mackrows"
Collection of all my macroes
'� Turn off calculation and screen refresh while macro is running. Be
' sure to restore settings when the macro ends. Some supposedly reset
' automatically but later releases tend to require you to reset.
' Macros may terminate abnormally so don�t use without that thought in
' mind. The examples below do not save current settings and restore
' them but assume normal usage is in effect.
'I always want calculation on and there are too many bad macros that
' fail and macro of my own that fail during testing so I use the
' version on the left above. The code on the right above is more
' correct but prone to problems of leaving calculation off.
'For most VBA actions, you don�t have to select the sheet or cell.
' Look for such coding to be reworked/removed, you might even be able
' to remove the need to suppress screen updating if the appearance of
' the screen is not changed. (Brian Wilson Example: 2000-12-28)
'Related to last row problems, macros can take forever to run if they
' loop through all possible columns and rows instead of restricting
' activity to the used area. Examples where such failures commonly
' occur: deleting rows with certain content, inserting rows or
' columns, selecting an entire column and macro processes entire
' column instead of cells in the active area.
H="Sub OutlineHolistica()"
Sub OutlineHolistica()
'
' OutlineHolistica Macro
' Macro recorded 2012-04-20 by ediblesound
'
'
Range("A2:C2").Select
Range("C2").Activate
With ActiveSheet.Outline
.AutomaticStyles = False
.SummaryRow = xlAbove
.SummaryColumn = xlRight
End With
Selection.Columns.Group
Range("A2:B2").Select
Range("B2").Activate
Selection.Columns.Group
Range("A2").Select
Selection.Columns.Group
Range("F2:I2").Select
Selection.Columns.Group
Range("F1:AP2").Select
Range("F2").Activate
' Selection.Columns.Ungroup
Selection.Columns.Group
Range("F2:I2").Select
Selection.Columns.Group
Range("K2:N2").Select
Selection.Columns.Group
Range("P2:R2").Select
Selection.Columns.Group
Range("T2:V2").Select
Selection.Columns.Group
Range("X2:Z2").Select
Selection.Columns.Group
Range("AB2:AD2").Select
Selection.Columns.Group
Range("AF2:AH2").Select
Selection.Columns.Group
Range("AJ2:AL2").Select
Selection.Columns.Group
Range("AF2:AM2").Select
Selection.Columns.Group
Range("AR2:AT2").Select
Selection.Columns.Group
Range("AR2:AV2").Select
Selection.Columns.Group
Range("AR1:DS3").Select
Range("AR2").Activate
Selection.Columns.Group
Range("AX2:BA2").Select
Selection.Columns.Group
Range("BC2:BF2").Select
Selection.Columns.Group
Range("BH1:BM1").Select
Selection.Columns.Group
Range("BH1:DR3").Select
Selection.Columns.Group
Range("BO1:BP1").Select
Selection.Columns.Group
Range("BR1:BT1").Select
Selection.Columns.Group
Range("BV1:CC1").Select
Selection.Columns.Group
Range("CE1:CT3").Select
Selection.Columns.Group
Range("CV1:CZ1").Select
Range("CZ1").Activate
Selection.Columns.Group
Range("DB1:DI1").Select
Selection.Columns.Group
Range("DL1:DQ1").Select
Selection.Columns.Group
Range("DU1").Select
' ActiveWindow.SmallScroll Down:=-6
' Windows("ML20120_Quick (version 1).xls").Activate
' Windows("Book4").Activate
' ActiveWindow.SmallScroll Down:=-18
' Windows("ML20120_Quick (version 1).xls").Activate
' Range("B2234").Select
' Application.Goto Reference:="R1C1"
' Windows("Book4").Activate
Range("B2").Select
Selection.Rows.Group
Range("A4:A16").Select
Selection.Rows.Group
Range("A7:A16").Select
Selection.Rows.Group
Range("A8:A10").Select
Selection.Rows.Group
Range("A12:A16").Select
Selection.Rows.Group
Range("A18:A40").Select
Selection.Rows.Group
Range("B19:B40").Select
Selection.Rows.Group
Range("B19").Select
End Sub
___________________________________________________________________________________
_________________
H="Sub Explicator()"
Sub Explicator()
'
' Explicator Macro
' Macro recorded 2012-04-20 by ediblesound
'
'
ActiveCell.Offset(0, 9).Columns("A:E").EntireColumn.Select
Selection.Insert Shift:=xlToRight
Selection.Interior.ColorIndex = 2
Selection.Clear
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
With Selection.Interior
.Pattern = xlGray50
.PatternColorIndex = 12
End With
Selection.Interior.PatternColorIndex = 12
ActiveCell.Offset(0, -4).Range("A1:D5").Select
ActiveCell.Range("A1:D5").Select
ActiveCell.Offset(0, -5).Columns("A:E").EntireColumn.Select
Selection.Interior.PatternColorIndex = 12
Selection.Interior.Pattern = xlGray50
ActiveCell.Offset(0, 5).Range("A1:D5").Select
ActiveCell.Offset(1, 0).Range("A1:D5").Select
ActiveCell.Offset(5, 0).Range("A1").Activate
ActiveCell.Offset(-5, 0).Range("A1:D5").Select
Selection.Insert Shift:=xlDown
ActiveWindow.SmallScroll ToRight:=17
ActiveCell.Offset(0, 13).Columns("A:E").EntireColumn.Select
Selection.Insert Shift:=xlToRight
Selection.Clear
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
Selection.Interior.PatternColorIndex = 12
Selection.Interior.Pattern = xlGray50
ActiveCell.Offset(0, 9).Columns("A:E").EntireColumn.Select
Selection.Insert Shift:=xlToRight
Selection.Clear
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
With Selection.Interior
.Pattern = xlGray50
.PatternColorIndex = 12
End With
Selection.Interior.PatternColorIndex = 12
End Sub
___________________________________________________________________________________
_________________
H="Sub PushstaggerVertical()"
Sub PushstaggerVertical()
'
' PushstaggerVertical Macro
' Macro recorded 2012-04-20 by ediblesound
'
' Keyboard Shortcut: Ctrl+w
'
Selection.Insert Shift:=xlDown
Selection.Clear
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
With Selection.Interior
.Pattern = xlGray50
.PatternColorIndex = 12
End With
Selection.Interior.PatternColorIndex = 12
End Sub
___________________________________________________________________________________
_________________
H="Sub PushStaggererHorizontalismical()"
Sub PushStaggererHorizontalismical()
'
' PushStaggererHorizontalismical Macro
' Macro recorded 2012-04-20 by ediblesound
'
' Keyboard Shortcut: Ctrl+q
'
Selection.Insert Shift:=xlToRight
Selection.Clear
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
End With
With Selection.Interior
.Pattern = xlGray50
.PatternColorIndex = 12
End With
Selection.Interior.PatternColorIndex = 12
Selection.Interior.ColorIndex = 2
End Sub
___________________________________________________________________________________
_________________
H="Sub ShowIt()"
Sub ShowIt()
Calender.Show
End Sub
___________________________________________________________________________________
_________________
H="Sub MTRowXpand()"
Sub MTRowXpand()
'
' RowCompress Macro
' Macro recorded 2012-03-29 by ediblesound
'
BeginRow = 16
EndRow = 376
ChkCol = 4
For RowCnt = BeginRow To EndRow
' If Cells(RowCnt, ChkCol).
'
' End If
If Cells(RowCnt, ChkCol).Value <> 88 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
' Cells(RowCnt, ChkCol).EntireRow.Height = 16
End If
Next RowCnt
'
End Sub
___________________________________________________________________________________
_________________
H="Sub HideColumnsAthroughC()"
Sub HideColumnsAthroughC()
' Adapted for use currently with the freshball strain of files. 2012-04-13 17:08:44
If Range("D391").Value = 0 Then
Columns("A:C").EntireColumn.Hidden = True
Else
Columns("A:C").EntireColumn.Hidden = False
End If
If Range("D391").Value = 0 Then
Columns("K:W").EntireColumn.Hidden = True
Else
Columns("K:W").EntireColumn.Hidden = False
End If
If Range("D391").Value = 0 Then
Columns("AB:AE").EntireColumn.Hidden = True
Else
Columns("AB:AE").EntireColumn.Hidden = False
End If
If Range("D391").Value = 0 Then
Columns("BC:BE").EntireColumn.Hidden = True
Else
Columns("BC:BE").EntireColumn.Hidden = False
End If
If Range("D391").Value = 0 Then
Columns("BI:BM").EntireColumn.Hidden = True
Else
Columns("BI:BM").EntireColumn.Hidden = False
End If
If Range("D391").Value = 0 Then
Columns("BU:CC").EntireColumn.Hidden = True
Else
Columns("BU:CC").EntireColumn.Hidden = False
End If
End Sub
___________________________________________________________________________________
_________________
H="Sub HideWorkBook()"
Sub HideWorkBook()
'
' HideWorkBook Macro
' Macro recorded 2012-03-31 by ediblesound
'
' Keyboard Shortcut: Ctrl+h
'
ActiveWindow.Visible = False
End Sub
___________________________________________________________________________________
_________________
Sub Unhide()
'
�}+--+{<+�Sub HideWorkBook()
H="Sub MakeSquare()"
Sub MakeSquare()
Dim WPChar As Double
Dim DInch As Double
Dim Temp As String
H="Sub FindCorruptConditionalFormat()"
Sub FindCorruptConditionalFormat()
' Selection.SpecialCells(xlCellTypeAllFormatConditions).Select
' For Each c In Selection.Cells
' For Each fc In c.FormatConditions
' If InStr(1, fc.Formula1, "#REF!", _
' vbBinaryCompare) > 0 Then
' MsgBox Prompt:=c.Address & ": " _
' & fc.Formula1, Buttons:=vbOKOnly
' End If
' Next fc
' Next c
End Sub
___________________________________________________________________________________
_________________
'
'' How do i get this to spit the references of these addresses onto a new sheet?!
2012-03-18 15:03:47
H="Sub RegionBorderMakerBR()"
Sub RegionBorderMakerBR()
'
' RegionBorderMakerV1 Macro
' Macro recorded 2012-04-01 by ediblesound
'
'
MsgBox Prompt:="Saving Active Workbook!", Buttons:=vbOKOnly
ActiveWorkbook.Save
'MsgBox Prompt:="Opening SeedSPot!", Buttons:=vbOKOnly
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\My Documents\My Workbooks and
Excel Documents\Default file location\RegionBorderSeedSPot.xls"
Windows("RegionBorderSeedSPot.xls").Activate
Application.Goto Reference:="RegiuonBorderSeedSPot"
Selection.Copy
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlMinimized
ActiveSheet.Paste
ActiveCell.Offset(0, 4).Columns("A:A").EntireColumn.ColumnWidth = 0.15
ActiveCell.Offset(0, 2).Columns("A:A").EntireColumn.ColumnWidth = 0.15
ActiveCell.Offset(4, 0).Range("A1").Select
Selection.RowHeight = 1.5
ActiveCell.Offset(-2, 0).Range("A1").Select
MsgBox Prompt:="Awesome! SeedSPot Cloney Planted! Sorry!, But you Get to Grow
it to your Region Desired, Until es Figures out how to do it via the
Macroawesomness, Thank you For Understanding! Lovely!", Buttons:=vbOKOnly
Selection.RowHeight = 1.5
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlNormal
' ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox Prompt:="Good Bye, Smoke some Pot Indeed! it is Lovely!",
Buttons:=vbOKOnly
End Sub
___________________________________________________________________________________
_________________
H="Sub RegionBorderMakerTR()"
Sub RegionBorderMakerTR()
'
' RegionBorderMakerV1 Macro
' Macro recorded 2012-04-01 by ediblesound
'
'
MsgBox Prompt:="Saving Active Workbook!", Buttons:=vbOKOnly
ActiveWorkbook.Save
MsgBox Prompt:="Opening SeedSPot!", Buttons:=vbOKOnly
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\My Documents\My Workbooks and
Excel Documents\Default file location\RegionBorderSeedSPot.xls"
Windows("RegionBorderSeedSPot.xls").Activate
Application.Goto Reference:="TRrbss"
Selection.Copy
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlMinimized
ActiveSheet.Paste
ActiveCell.Offset(0, 4).Range("A1").Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
ActiveCell.Offset(2, -2).Range("A1").Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
MsgBox Prompt:="Awesome! SeedSPot Cloney Planted! Sorry!, But you Get to Grow
it to your Region Desired, Until es Figures out how to do it via the
Macroawesomness, Thank you For Understanding! Lovely!", Buttons:=vbOKOnly
Selection.RowHeight = 1.5
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlNormal
' ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox Prompt:="Good Bye, Smoke some Pot Indeed! it is Lovely!",
Buttons:=vbOKOnly
End Sub
___________________________________________________________________________________
_________________
H="Sub RegionBorderMakerTL()"
Sub RegionBorderMakerTL()
'
' RegionBorderMakerV1 Macro
' Macro recorded 2012-04-01 by ediblesound
'
'
MsgBox Prompt:="Saving Active Workbook!", Buttons:=vbOKOnly
ActiveWorkbook.Save
MsgBox Prompt:="Opening SeedSPot!", Buttons:=vbOKOnly
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\My Documents\My Workbooks and
Excel Documents\Default file location\RegionBorderSeedSPot.xls"
Windows("RegionBorderSeedSPot.xls").Activate
Application.Goto Reference:="TLrbss"
Selection.Copy
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlMinimized
ActiveSheet.Paste
ActiveCell.Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
ActiveCell.Offset(2, 2).Range("A1").Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
MsgBox Prompt:="Awesome! SeedSPot Cloney Planted! Sorry!, But you Get to Grow
it to your Region Desired, Until es Figures out how to do it via the
Macroawesomness, Thank you For Understanding! Lovely!", Buttons:=vbOKOnly
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlNormal
' ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox Prompt:="Good Bye, Smoke some Pot Indeed! it is Lovely!",
Buttons:=vbOKOnly
End Sub
___________________________________________________________________________________
_________________
H="Sub RegionBorderMakerBL()"
Sub RegionBorderMakerBL()
'
' RegionBorderMakerV1 Macro
' Macro recorded 2012-04-01 by ediblesound
'
'
MsgBox Prompt:="Saving Active Workbook!", Buttons:=vbOKOnly
ActiveWorkbook.Save
MsgBox Prompt:="Opening SeedSPot!", Buttons:=vbOKOnly
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\My Documents\My Workbooks and
Excel Documents\Default file location\RegionBorderSeedSPot.xls"
Windows("RegionBorderSeedSPot.xls").Activate
Application.Goto Reference:="BLrbss"
Selection.Copy
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlMinimized
ActiveSheet.Paste
ActiveCell.Select
ActiveCell.Offset(4, 0).Range("A1").Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
ActiveCell.Offset(-2, 2).Range("A1").Select
Selection.RowHeight = 1.5
Selection.ColumnWidth = 0.15
MsgBox Prompt:="Awesome! SeedSPot Cloney Planted! Sorry!, But you Get to Grow
it to your Region Desired, Until es Figures out how to do it via the
Macroawesomness, Thank you For Understanding! Lovely!", Buttons:=vbOKOnly
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlNormal
' ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox Prompt:="Good Bye, Smoke some Pot Indeed! it is Lovely!",
Buttons:=vbOKOnly
End Sub
___________________________________________________________________________________
_________________
H="Sub TextBox2Cell()"
Sub TextBox2Cell()
' The following
'macro will create a text box directly over the selected cell, and size it to
'be exactly the same size as the selected cell:
'cntrl t
With ActiveCell
ActiveSheet.Shapes.AddTextbox _
msoTextOrientationHorizontal, .Left, _
.Top, .Width, .Height
End With
End Sub
___________________________________________________________________________________
_________________
'With a small change in the macro, you can modify it so that it will create
'text boxes that are just as large as whatever range of cells you have
'selected:
Sub TextBox2Selection()
If TypeName(Selection) = "Range" Then
With Selection
ActiveSheet.Shapes.AddTextbox _
msoTextOrientationHorizontal, .Left, _
.Top, .Width, .Height
End With
End If
End Sub
___________________________________________________________________________________
_________________
'
'Regardless of which approach you use to create the text box (manual or
'macro), it should be noted that if you resize the cell by changing the column
'width or row height, the size of the text box will also change to match the
'new cell size. cntrol I
Sub ChangeToRECTANGLE()
'
H="Sub whiteONblack()"
Sub whiteONblack()
'
' whiteONblack Macro
' Macro recorded 2012-04-11 by ediblesound
'
' Keyboard Shortcut: Ctrl+n
'
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
Selection.Font.ColorIndex = 1
Selection.Font.ColorIndex = 2
End Sub
___________________________________________________________________________________
_________________
H="Sub ListCFing()"
Sub ListCFing()
Dim NewSh As Worksheet
Dim x As Long
Dim Sh As Worksheet
Dim Rng As Range
Dim c As Range
Dim FC As FormatConditions
Dim Cond As FormatCondition
Dim CondNo As Integer
x = 1
Application.ScreenUpdating = False
Set NewSh = Worksheets.Add
With NewSh
.Cells(x, 1) = "Sheet"
.Cells(x, 2) = "Cell"
.Cells(x, 3) = "No"
.Cells(x, 4) = "Type"
.Cells(x, 5) = "Operator"
.Cells(x, 6) = "Formula1"
.Cells(x, 7) = "Formula2"
.Range(.Cells(x, 1), .Cells(x, 7)).Font.Bold = True
End With
For Each Sh In ThisWorkbook.Worksheets
Set Rng = Sh.UsedRange
On Error Resume Next
Set Rng = Rng.SpecialCells(xlCellTypeAllFormatConditions)
If Err Then GoTo None
For Each c In Rng
Set FC = c.FormatConditions
CondNo = 0
For Each Cond In FC
x = x + 1
CondNo = CondNo + 1
With NewSh
.Cells(x, 1) = Sh.Name
.Cells(x, 2) = c.Address(0, 0)
.Cells(x, 3) = CondNo
Select Case Cond.Type
Case xlCellValue: .Cells(x, 4) = "Value"
Case xlExpression: .Cells(x, 4) = "Expression"
End Select
Select Case Cond.Operator
Case xlBetween: .Cells(x, 5) = "Between"
Case xlEqual: .Cells(x, 5) = "="
Case xlGreater: .Cells(x, 5) = ">"
Case xlGreaterEqual: .Cells(x, 5) = ">="
Case xlLess: .Cells(x, 5) = "<"
Case xlLessEqual: .Cells(x, 5) = "<="
Case xlNotBetween: .Cells(x, 5) = "NotBetween"
Case xlNotEqual: .Cells(x, 5) = "<>"
End Select
.Cells(x, 6).NumberFormat = "@"
.Cells(x, 6) = Cond.Formula1
.Cells(x, 7).NumberFormat = "@"
.Cells(x, 7) = Cond.Formula2
End With
Next Cond
Next c
None:
Next Sh
NewSh.UsedRange.EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
H="'AddressVolatile"
'Preeminent Macro to date 2012-04-05 23:29:27
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
' Range("A1").Value = Selection.Address
End Sub
___________________________________________________________________________________
_________________
Public Function CurrentCell() As String
Application.Volatile
CurrentCell = Selection.Address
End Function
H="'Datestomper"
Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
With Target(1, 0)
.Value = Now
End With
End If
End Sub
___________________________________________________________________________________
_________________
H="Sub SeedSpotPositionArchForSight()"
Sub SeedSpotPositionArchForSight()
'
' SeedSpotPositionArchForSight Macro
' Macro recorded 2012-04-20 by ediblesound
'
'
MsgBox Prompt:="Saving Active Workbook!", Buttons:=vbOKOnly
ActiveWorkbook.Save
MsgBox Prompt:="Opening SeedSPot!", Buttons:=vbOKOnly
Workbooks.Open Filename:= _
"C:\Documents and Settings\Administrator\My Documents\My Workbooks and
Excel Documents\Default file location\RegionBorderSeedSPot.xls"
Windows("RegionBorderSeedSPot.xls").Activate
Sheets("Sheet2").Select
ActiveSheet.Shapes.Range(Array("Group 3", "Group 6", "Group 9")).Select
Selection.Copy
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlMinimized
ActiveSheet.Paste
MsgBox Prompt:="Excellent! Now you can use this template to help line up your
initial target cell for the SeedSpot Placement!", Buttons:=vbOKOnly
Windows("RegionBorderSeedSPot.xls").Activate
ActiveWindow.WindowState = xlNormal
' ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox Prompt:="Good Bye, Smoke some Pot Indeed! it is Lovely!",
Buttons:=vbOKOnly
End Sub
___________________________________________________________________________________
_________________
H="Sub tl()"
Sub tl()
'
' tl Macro
' Macro recorded 2012-04-16 by ediblesound
'
'
With All.ActiveWindows
.Top = 1.70588235294118
.Left = 1.70588235294118
End With
End Sub
___________________________________________________________________________________
_________________
H="SOmeLockiones"
'Hi,
'Here are a couple of macros I use.
'Enter them into "ThisWorkbook Item"
'ie, once in the workbook, press Alt+F11 to activate the VBE
'Locate the worlbook in the Project window
'Double-click the project to display ite items, if necessary.
'Double-click the ThisWorkbook item. - The VBE displays an empty code window for
the ThisWorkbook object
'In the Code window, select Workbook from the Object (left) drop down list, and
enter the following vba code.
'Note, I have a couple of lines of code that I enter to limit the scrolling area to
stop people scrolling down to the bottom of the page, and also another line of code
to limit access to only unlocked cells.
'
'Dont forget to return the caption to "Excel and the file name" when you are
finished.
'Change the caption from Excel and file name to whatever you want
Application.Caption = "My name and any other information here"
End Sub
___________________________________________________________________________________
_________________
End Sub
___________________________________________________________________________________
_________________
'now change text color for all dates earlier than today
'set start of date column
Set rngDateStart = wsEach.Range(strDateCol & "2")
'set end of date column
Set rngDateEnd = wsEach.Range(strDateCol & CStr(Application.Rows.Count)) _
.End(xlUp)
For Each rngCell In wsEach.Range(rngDateStart, rngDateEnd)
'use integers to exclude any time information stored with dates
If Int(rngCell.Value) < Int(Now) Then
rngCell.Font.Color = RGB(200, 0, 20)
Else
rngCell.Font.Color = RGB(0, 0, 0)
End If
Next rngCell
End If
Next wsEach
'error handler
ErrHnd:
Err.Clear
'restore screen updating
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
'Regards
H="'HyperlinkFileList"
'Code:
i'nstructions for use
End Function
Sub HyperlinkFileList()
'Macro purpose: To create a hyperlinked list of all files in a user
'specified directory, including file size and date last modified
'NOTE: The 'TextToDisplay' property (of the Hyperlink object) was added
'in Excel 2000. This code tests the Excel version and does not use the
'Texttodisplay property if using XL 97.
End Sub
___________________________________________________________________________________
_________________
'
'How to use:
'Copy above code.
'In Excel press Alt + F11 to enter the VBE.
'Press Ctrl + R to show the Project Explorer.
'Right-click desired file on left (in bold).
'Choose Insert -> Module.
'Paste code into the right pane.
'Scroll to find the "Function Excludes" function
'Review the line starting "X=Array". Remove any extension you DO want
' to see in the list, and add any extension you DONT want to see in
' the list. (For example if you dont want to see Word documents, add:
' ,"doc" after the "zip" portion of the line)
'Press Alt + Q to close the VBE.
'Save workbook before any other changes.
H="'MacroFormulasToWord"
'
'a macro that actually pulled the formulas and placed them in a Word
' document for you. The following Excel macro will do just that:
Sub WriteFormulasToWord()
Dim Wrd As New Word.Application
Dim CellTxt As String
Dim CellAddr As String
Dim SRow As Long
Dim SCol As Long
Wrd.Visible = True
Wrd.Documents.Add
'
'There are a couple of things to note in this macro. First of all, you
' can change the range of rows and columns over which the macro works
' by changing the noted For statements that use both SCol and SRow. In
' the example shown above, the macro pulls formulas from columns 1
' through 5 (A through E) and rows 1 through 10.
'In addition, this macro will not work properly unless you set up
' Excel macros to handle references to Word objects. You do that by
' following these steps within the VBA Editor:
'Choose References from the Tools menu. VBA displays the References
' dialog box. (See Figure 3.)
H="Sub CDLFRMTFNDR()"
Sub CDLFRMTFNDR()
Dim NewSh As Worksheet
Dim x As Long
Dim Sh As Worksheet
Dim Rng As Range
Dim c As Range
Dim FC As FormatConditions
Dim Cond As FormatCondition
Dim CondNo As Integer
x = 1
Application.ScreenUpdating = False
Set NewSh = Worksheets.Add
With NewSh
.Cells(x, 1) = "Sheet"
.Cells(x, 2) = "Cell"
.Cells(x, 3) = "No"
.Cells(x, 4) = "Type"
.Cells(x, 5) = "Operator"
.Cells(x, 6) = "Formula1"
.Cells(x, 7) = "Formula2"
.Range(.Cells(x, 1), .Cells(x, 7)).Font.Bold = True
End With
For Each Sh In ThisWorkbook.Worksheets
Set Rng = Sh.UsedRange
On Error Resume Next
Set Rng = Rng.SpecialCells(xlCellTypeAllFormatConditions)
If Err Then GoTo None
For Each c In Rng
Set FC = c.FormatConditions
CondNo = 0
For Each Cond In FC
x = x + 1
CondNo = CondNo + 1
With NewSh
.Cells(x, 1) = Sh.Name
.Cells(x, 2) = c.Address(0, 0)
.Cells(x, 3) = CondNo
Select Case Cond.Type
Case xlCellValue: .Cells(x, 4) = "Value"
Case xlExpression: .Cells(x, 4) = "Expression"
End Select
Select Case Cond.Operator
Case xlBetween: .Cells(x, 5) = "Between"
Case xlEqual: .Cells(x, 5) = "="
Case xlGreater: .Cells(x, 5) = ">"
Case xlGreaterEqual: .Cells(x, 5) = ">="
Case xlLess: .Cells(x, 5) = "<"
Case xlLessEqual: .Cells(x, 5) = "<="
Case xlNotBetween: .Cells(x, 5) = "NotBetween"
Case xlNotEqual: .Cells(x, 5) = "<>"
End Select
.Cells(x, 6).NumberFormat = "@"
.Cells(x, 6) = Cond.Formula1
.Cells(x, 7).NumberFormat = "@"
.Cells(x, 7) = Cond.Formula2
End With
Next Cond
Next c
None:
Next Sh
NewSh.UsedRange.EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
H="'Create an Anchored Shape (#anchor)"
'Create an Anchored Shape (#anchor)
'Creating a shape anchored to the four borders of a cell. Even though
'the shape is anchored to the four borders, you can manually move the
'image and change it's shape, but the image remains anchored to the
'four original points (cell's top, left, width, height)and will
'distort according to their movement of those borders. (see code on
'left below)
With Range("J4")
ActiveSheet.Shapes.AddShape _
Type:=msoShapeSmileyFace, _
Left:=.Left, _
Top:=.Top, _
Width:=.Width, _
Height:=.Height
End With
With Range("K10")
With ActiveSheet.Shapes.AddShape( _
Type:=msoShapeSmileyFace, _
Top:=.Top, Left:=.Left, _
Width:=.Width, _
Height:=.Height)
.Placement = xlFreeFloating
End With
End With
'Hallo All,
'I have two excel files one is Main_data.xls and second one is
' Secondary_data.xls having some of the columns from Main_data.xls
'Regards,
'Venu.
'
'Hi Venu,
'VB:
Sub GetExternalData()
Dim FilePath As String
Dim FileName As String
Dim FullName As String
Dim MyName
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
'Introduction
'The code on this page will preserve the Visible property of each
' sheet. Thus, if you have sheets other than the introduction sheet
' that need to remain hidden or very hidden, the code will accommodate
' those sheets. It will not make visible any sheet that normally is
' hidden or very hidden.
'Paste all of the following code into a regular code module. Change
' the lines marked with '<<<< CHANGE to the appropriate values.
Option Explicit
Private Const C_SHEETSTATE_NAME = "SheetState"
Private Const C_INTRO_SHEETNAME = "Introduction" '<<<< CHANGE
Private Const C_WORKBOOK_PASSWORD = "abc" '<<<< CHANGE
___________________________________________________________________________________
_________________
Sub SaveStateAndHide()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SaveStateAndHide
' This is called from Workbook_BeforeClose.
' This procedure saves the Visible propreties of all worksheets
' in the workbook. This will run only if macros are enabled. It
' saves the Visible properties as a colon-delimited string, each
' element of which is the Visible property of a sheet. In the
' property string, C_INTRO_SHEETNAME is set to xlSheetVeryHidden
' so that if the workbook is opened with macros enabled, that
' sheet will not be visible. If macros are not enabled, only
' that sheet will be visible.
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim S As String
Dim WS As Object
Dim N As Long
''''''''''''''''''''''''''''''''''''''''''''
' Protection settings. We must be
' able to unprotect the workbook in
' order to modify the sheet visibility
' properties. We will restore the
' protection at the end of this procedure.
''''''''''''''''''''''''''''''''''''''''''''
Dim HasProtectWindows As Boolean
Dim HasProtectStructure As Boolean
'''''''''''''''''''''''''''''''''''''''''''''''
' Save the workbook's protection settings and
' attempt to unprotect the workbook.
'''''''''''''''''''''''''''''''''''''''''''''''
HasProtectWindows = ThisWorkbook.ProtectWindows
HasProtectStructure = ThisWorkbook.ProtectStructure
ThisWorkbook.Unprotect Password:=C_WORKBOOK_PASSWORD
'''''''''''''''''''''''''''''''''''''''''''''''
' Make the introduction sheet visible
'''''''''''''''''''''''''''''''''''''''''''''''
ThisWorkbook.Worksheets(C_INTRO_SHEETNAME).Visible = xlSheetVisible
'''''''''''''''''''''''''''''''''''''''''''''''
' Delete the Name. Ignore error if it doesn't
' exist.
On Error Resume Next
'''''''''''''''''''''''''''''''''''''''''''''''
ThisWorkbook.Names(C_SHEETSTATE_NAME).Delete
Err.Clear
On Error GoTo 0
For Each WS In ThisWorkbook.Sheets
'''''''''''''''''''''''''''''''''''''''''''''''
' Create a string of the sheet visibility
' properties, separated by ':' characters.
' Do not put a ':' after the last sheet. Always
' set the visible property of the Introduction
' sheet to xlSheetVeryHidden. Don't put a ':'
' after the last sheet visible property.
'''''''''''''''''''''''''''''''''''''''''''''''
S = S & IIf(StrComp(WS.Name, C_INTRO_SHEETNAME, vbTextCompare) = 0, _
CStr(xlSheetVeryHidden), CStr(WS.Visible)) & _
IIf(WS.Index = ThisWorkbook.Sheets.Count, "", ":")
'''''''''''''''''''''''''''''''''''''''''''''''
' If WS is the intro sheet, make it visible,
' otherwise make it VeryHidden. This sets all
' sheets except C_INTRO_SHEETNAME to very
' hidden.
''''''''''''''''''''''''''''''''''''''''''''''''
If StrComp(WS.Name, C_INTRO_SHEETNAME, vbTextCompare) = 0 Then
WS.Visible = xlSheetVisible
Else
WS.Visible = xlSheetVeryHidden
End If
Next WS
''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Save the property string in a defined name.
''''''''''''''''''''''''''''''''''''''''''''''''''''''
ThisWorkbook.Names.Add Name:=C_SHEETSTATE_NAME, RefersTo:=Chr(39) & S,
Visible:=False
''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Set the workbook protection back to what it was.
''''''''''''''''''''''''''''''''''''''''''''''''''''''
ThisWorkbook.Protect C_WORKBOOK_PASSWORD, _
structure:=HasProtectStructure, Windows:=HasProtectWindows
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub UnHideSheets()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' UnHideSheets
' This is called by Workbook_Open to hide the introduction sheet
' and set all the other worksheets to their visible state that
' was stored when the workbook was last closed. The introduction
' sheet is set to xlSheetVeryHidden. This maro is executed only
' is macros are enabled. If the workbook is opened without
' macros enabled, only the introduction sheet will be visible.
' If an error occurs, make the intro sheet visible and get out.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim S As String
Dim N As Long
Dim VisibleArr As Variant
Dim HasProtectWindows As Boolean
Dim HasProtectStructure As Boolean
'''''''''''''''''''''''''''''''''''''''''''''''
' Save the workbook's protection settings and
' attempt to unprotect the workbook.
'''''''''''''''''''''''''''''''''''''''''''''''
HasProtectWindows = ThisWorkbook.ProtectWindows
HasProtectStructure = ThisWorkbook.ProtectStructure
ThisWorkbook.Unprotect Password:=C_WORKBOOK_PASSWORD
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Set VisibleArr to an array of the visible properties,
' one element per worksheet.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
If InStr(1, S, ":", vbBinaryCompare) = 0 Then
VisibleArr = Array(S)
Else
VisibleArr = Split(S, ":")
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Loop through the array and set the Visible propety
' for each sheet. If we're processing the C_INTRO_SHEETNAME
' sheet, make it Visible (since it may be the only
' visbile sheet). We'll hide it later after the
' loop.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
For N = LBound(VisibleArr) To UBound(VisibleArr)
If StrComp(ThisWorkbook.Sheets(N - LBound(VisibleArr) + 1).Name,
C_INTRO_SHEETNAME) = 0 Then
ThisWorkbook.Sheets(C_INTRO_SHEETNAME).Visible = xlSheetVisible
Else
ThisWorkbook.Sheets(N - LBound(VisibleArr) + 1).Visible =
CLng(VisibleArr(N))
End If
Next N
''''''''''''''''''''''''''''''''
' Hide the INTRO sheet.
''''''''''''''''''''''''''''''''
ThisWorkbook.Sheets(C_INTRO_SHEETNAME).Visible = xlSheetVeryHidden
''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Set the workbook protection back to what it was.
''''''''''''''''''''''''''''''''''''''''''''''''''''''
ThisWorkbook.Protect Password:=C_WORKBOOK_PASSWORD, _
structure:=HasProtectStructure, Windows:=HasProtectWindows
Exit Sub
ErrHandler:
ThisWorkbook.Worksheets(C_INTRO_SHEETNAME).Visible = xlSheetVisible
End Sub
___________________________________________________________________________________
_________________
'For an alternative technique, using formula calculations and defined
' names, to ensure that a workbook is opened with macros enabled, see
' the Ensuring Macros Are Enabled, Part 2 page.
___________________________________________________________________________________
_________________
'With the use of Excel VBA Macro code we can create a list of
' Hyperlinked Excel Workbook names on any Excel Worksheet. The code
' below can be used on any version of Excel, 2000 or higher. The only
' changes needed are to the file paths used. The part of the code that
' reads: .Filename = "Book*.xls" has been commented out but can be
' uncommented if you wish to restrict the list to that of specific
' Excel Workbook name. Note also the code 'as is' restricts the list
' to only Excel Workbooks. However, this can be any of the File types
' listed below;
msoFileTypeAllFiles
msoFileTypeBinders
msoFileTypeCalendarItem
msoFileTypeContactItem
msoFileTypeCustom
msoFileTypeDatabases
msoFileTypeDataConnectionFiles
msoFileTypeDesignerFiles
msoFileTypeDocumentImagingFiles
msoFileTypeExcelWorkbooks
msoFileTypeJournalItem
msoFileTypeMailItem
msoFileTypeNoteItem
msoFileTypeOfficeFiles
msoFileTypeOutlookItems
msoFileTypePhotoDrawFiles
msoFileTypePowerPointPresentations
msoFileTypeProjectFiles
msoFileTypePublisherFiles
msoFileTypeTaskItem
msoFileTypeTemplates
msoFileTypeVisioFiles
msoFileTypeWebPages
msoFileTypeWordDocuments
Ensure the active Worksheet at the time of running the code is clean so as to not
over write existing data.
Sub HyperlinkXLSFiles()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\MyDocuments\Testings"
.FileType = msoFileTypeExcelWorkbooks
.FoundFiles(lCount), TextToDisplay:= _
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
H="Timebombing A Workbook"
'Introduction
'You should change the value of this constant to number of days after
' the first usage of the workbook that the workbook should be
' disabled. The value provided in the is 30 days. On the 31st day
' after the first time the workbook is opened, it will become
' unusable.
Sub TimeBombWithDefinedName()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' TimeBombWithDefinedName
' This procedure uses a defined name to store this workbook's
' expiration date. If the expiration date has passed, a
' MsgBox is displayed and this workbook is closed.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim ExpirationDate As String
Dim NameExists As Boolean
''''''''''''''''''''''''''''''''''''''''''''''''''''''
' If the today is past the expiration date, close the
' workbook. If the defined name didn't exist, we need
' to Save the workbook to save the newly created name.
''''''''''''''''''''''''''''''''''''''''''''''''''''''
If CDate(Now) > CDate(ExpirationDate) Then
MsgBox "This workbook trial period has expired.", vbOKOnly
ThisWorkbook.Close savechanges:=False
End If
End Sub
___________________________________________________________________________________
_________________
'CAUTION: This code will permanently delete (not Recycle) the workbook
' that contains the code. Once deleted, there is no way to get the
' workbook back. Be sure you that when you are testing you have
' another copy of the code.
'However you store and calculate the expiration date, you can use the
' code below to delete the workbook containing the code.
Sub CommintSuicide()
With ThisWorkbook
Application.DisplayAlerts = False
If .Path <> vbNullString Then
.ChangeFileAccess xlReadOnly
Kill .FullName
End If
ThisWorkbook.Close SaveChanges:=False
End With
End Sub
___________________________________________________________________________________
_________________
'TimeBomb To Read-Only
Sub TimeBombMakeReadOnly()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' TimeBombMakeReadOnly
' This procedure uses a defined name to store the expiration
' date and if the workbook has expired, makes the workbook
' read-only.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
___________________________________________________________________________________
_________________
Sub TimeBombWithRegistry()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' TimeBombWithRegistry
' This procedure stores the expiration date in the system
' registry. Change C_REG_KEY to a registry key name that
' is used by your application.
'
' This procedure requires either the modRegistry module from
' www.cpearson.com/Excel/Registry.htm or
' www.cpearson.com/Excel/Registry.aspx
' or the RegistryWorx DLL from
' www.cpearson.com/Excel/RegistryWorx.aspx.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
___________________________________________________________________________________
_________________
'Note that this will not work if the user has disabled VBA code or has
' set the Application.EnableEvents property to False.
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
Option Explicit
'-- David McRitchie http://www.mvps.org/dmcritchie/excel/formula.htm
'-- http://www.mvps.org/dmcritchie/excel/code/formula.txt
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="GetFormula"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="GetFormulaD"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="Function GetFormat"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="GetFormatD"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="GetFormulaI"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H=" GetFormulaID(cell As Ran"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="tFormulaX(cell As Ra"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="tFontName(cell As Ran"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="HasFormula(cell)"
Function HasFormula(cell)
'created using a suggestion by Nick Manton nickm@sri.com
' http://www.mvps.org/dmcritchie/excel/formula.htm
HasFormula = cell.HasFormula
End Function
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="ondFormula(myCell As R"
H="Sub FormulaBox()"
Sub FormulaBox()
'David McRitchie 1998-08-12 1999-08-17
' http://www.mvps.org/dmcritchie/excel/formula.htm
'Place material into MsgBox [ctrl+n]
'Will process ranges of one or more columns
'Application.ScreenUpdating = False
Dim MsgBoxx As String
Dim ix As Long
Dim vGetFormulaI As String, xyx As String
MsgBoxx = "First Character of " _
& Selection.Item(ix).Address(0, 0) & " is """ _
& Left(ActiveCell.Value, 1) & """ =CHR(" _
& Right("0000" & Asc(ActiveCell.Value), 4) & ") or Hex=x'" _
& Hex(Asc(ActiveCell.Value)) & "'" & Chr(10) _
& "Last Character is """ & Right(ActiveCell.Value, 1) _
& """ =CHR(" _
& Right("0000" & Asc(Right(ActiveCell.Value, 1)), 4) & ") or Hex=x'" _
& Hex(Asc(Right(ActiveCell.Value, 1))) & "'" & Chr(10) _
& ActiveCell.Font.Name & " " & ActiveCell.Font.Size _
& " " & ActiveCell.Font.FontStyle _
& ", color: " & ActiveCell.Font.ColorIndex _
& " interior: " & ActiveCell.Interior.ColorIndex _
& Chr(10) & Chr(10)
For ix = 1 To Selection.Count
'Selection.Item(ix).NoteText _ ...
vGetFormulaI = ""
If VarType(Selection.Item(ix)) = 8 Then
vGetFormulaI = "'" & Selection.Item(ix).Formula
Else
vGetFormulaI = Selection.Item(ix).Formula
End If
If Selection.Item(ix).HasArray Then _
vGetFormulaI = "{" & Selection.Item(ix).Formula & "}"
Next
MsgBoxx = MsgBoxx & Chr(10) & "***" _
& Chr(10) & _
LCase(ActiveWorkbook.FullName) & " " & ActiveSheet.Name
'to verify you've seen everything
xyx = MsgBox(MsgBoxx, , _
"FormulaBox: Formula & Format & Text for " _
& Selection.Count & " selected cells")
'Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="Sub FormulaSheet()"
Sub FormulaSheet()
'Print information for each non empty cell DMcRitchie 2001-04-30
'Documented in http://www.mvps.org/dmcritchie/excel/formula.htm
'Also see John Walkenbach -- Tip 37 which is formulas only
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim irow As Long, cell As Range
Dim oSheet As Worksheet, nSheet As Worksheet
Dim oCells As Range
irow = 1
Set oSheet = ActiveSheet
Set nSheet = ActiveWorkbook.Worksheets.Add
nSheet.Name = oSheet.Name & " content at " _
& Format(Now(), "hhmss")
nSheet.Cells(1, 1) = "Cell"
nSheet.Cells(1, 2) = "Text"
nSheet.Cells(1, 3) = "Value"
nSheet.Cells(1, 4) = "Formula"
nSheet.Cells(1, 5) = "NumberFormat"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="Function UseFormula(cell)"
Function UseFormula(cell)
'David McRitchie Jul 20, 1998 if this is valid will be
'Documented in http://www.mvps.org/dmcritchie/excel/formula.htm
UseFormula = Application.Evaluate(cell.Formula)
'If "'" <> Left(cell.formula, 1) Then UseFormula = "'" & cell.formula
End Function
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="eFormula2(cell As Ran"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="UseSameAs(cell As Ran"
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H=" WhereAmI()"
Sub WhereAmI()
'D.McRitchie, pathname.htm, excel.misc 1999-07-30
MsgBox ActiveWorkbook.FullName & Chr(10) & _
"Microsoft Excel is using " & Application.OperatingSystem
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
Sub Euro_Format()
Selection.NumberFormat = _
"_(�* #,##0.00_);_(�* (#,##0.00);_(�* "" - ""???_);_(@_)"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
H="n showAlign(cell As Range)"
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
'The following does same for displayed text (constants and formulas).
' It is practical only for testing things that need a lot of comments
' generated. Such test data can be created with MarkCells and then
' run the following macro. Note use of Del key does not affect cell
' comments.
Sub TextIntoComments()
Dim cell As Range
Selection.ClearComments
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
If Trim(cell.Text) <> "" Then
cell.AddComment cell.Text
cell.Comment.Visible = False
cell.Comment.Shape.TextFrame.AutoSize = True
End If
Next cell
End Sub
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
'The following macro will add a sheet to the workbook, with a list of
' Excel comments from all sheets in the workbook, including the sheet
' name, cell address, and cell name, if any.
Sub ShowCommentsAllSheets()
'modified from code
'posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False
newwks.Range("A1:E1").Value = _
Array("Sheet", "Address", "Name", "Value", "Comment")
i = newwks.Cells(Rows.Count, 1).End(xlUp).Row
For Each mycell In commrange
With newwks
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = ws.Name
.Cells(i, 2).Value = mycell.Address
.Cells(i, 3).Value = mycell.Name.Name
.Cells(i, 4).Value = mycell.Value
.Cells(i, 5).Value = mycell.Comment.text
End With
Next mycell
End If
Set commrange = Nothing
Next ws
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
H="Insert a Plain Comment"
'To insert a comment with no User Name, use the following macro.
'Note: Because the macro contains a SendKeys command, it should be run
' with the worksheet active, not Visual Basic Explorer.
Sub CommentAddOrEdit()
'adds new plain text comment or positions
'cursor at end of existing comment text
'www.contextures.com\xlcomments03.html
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment text:=""
End If
SendKeys "%ie~"
End Sub
___________________________________________________________________________________
_________________
'To avoid use of the SendKeys command, you can use the following
' variation, which leaves the Excel comments visible. After running
' the macro, the comment shape is selected. Start typing, and the text
' will be added to the comment box, or to the end of the existing
' comment text.
Sub CommentAddOrEdit()
'method suggested by Jon Peltier 2006-03-04
'adds new plain text comment or adds text
'at end of existing comment text
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
Set cmt = ActiveCell.AddComment
cmt.text text:=""
End If
End Sub
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*(0&^**=/^*&^*&^*(0&^*&^*&^*&^*&^*&^*&^*&^*&*=-=/*-
=^*&^*&^*&^*&^*&^*&^*&^=/**&^*&^*&^*&^*&^*&^*&^
=_)(_)(_)(_-*/)(_(0)(_)((0_)(_)(_)-*=(0/(_)(_)(_)(_)(/=_*)(_)(_)(_)(_)=(-_)(_)
(_/==)(_)(_)(_)(_)(_)(_)(_*=/)(_)(_)(_)(_)(_)(_(0
!^/*-/!^/!^/!^/!(0^/--*/!^/!^/!(0^/!^/(0!^/!^/!-=/^/!^/=!*^/!^//=!*^/!*-=^-*/!^/!
^/!^/!^/!^-*=/!^/!^/!^/!^/!^/!^/!^/=-*/!^/!^/!^/!^/!^
(0!^?>/=*(0<!^?>*<!^-?-*/>*<(0!^(0?>*<!^?>*-=*-*=<!^?>*<!*==^?>*<!^?>*<!^?>*<!=-
=//-^?>*<!^?>*=<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>
/][/(0][(0/][/]/*-[/][/][/][/][/][/](0[/-*/][/][/][(0/][-*=/*-][/][/][/][/--*=*-=]
[/][/*]=/[/][/][/][/][/][/][/][/][/][-=-=-=///][/][/][//*/=
\+\(0_\=(0-\=-=/\=-\=-\(0=-\=-\=--**/=/-\=-\=-\-=/=-*=/-\=-\=-\=--*=\=-\=-
*/=\=-\=-\=-\=-\=-\=-\=*-=-\=-*-*/=\=-(0\=*/=*-\=-\=-\=-\=-_\=-\=-\-
(0}?}?}/}/}/(0]/}/]*-/(0]?}/}/}/}?}*=/?]/}?-**-=//]/}?]/}?]/}?]/}?]/}?-*=]/}?]/}?
*]/}?]/}?]/}?]/}?]/}?]/}?**=/-=]/}?]/}?]/}(0?]/}?(0
><)(><)(><((00)(><)(><)(=-><)(>*=<)(-*/><)(><)(><)(><)(>-*=<)(><)/=(><)(><)(><)(*-
=><)(>-=/<)(><)(><)(><)(0(>(0<(0)(><)(><)(><)(><
|+__|+_(0_|+__|(0+__|+=*__|+_*=-_|+__|+_-*/_|+__|+__|+___|+__-*|-*=+_*=_-*_|+__/*_|
+____|+__-=/|+__|+(0___|+___|+_||+(0__|+__|+__|+_
{}!{}!(0{}!{}!{}!{}!={/(0=*/}!{}*=/-!{}!{}!{}!{}!{}!{}!{}!{}-*/!{}!{}!(0{}!{}!{}!
{}!{}!{}!{}!{*-=}!/={=/}!{}!{}!{}!{}!{}!{}!-=/{}!(0
__(0_________-/-*/__*(0=/-__=-_____(0_______________-*/___________________-
*=________________-*=______________________________
|+__|+_*-/=_|+-*=_-_|+__|+(0_*/_|(0+__|+__|+__|+__|+__|-*/+___|+__|+___|+___|+_-
*=___|+__|+__|+___==/-/|+___|+_||+__|+__|+__|+_
_)(_)*=/(_)*/=(_)(_)(_)(_)(_)=(_(0)(_)(_)(_)(_)(_)(_)(_)(_)-*/(_)(_)(_)(_)(_)(_)(_)
(_)(_*-=)(_)(_)(_)(_)(_)(_)(*/=_)(_
*&*^*&^*&^*&^*&^*&^*&/=^*&^*&^*&^*&^*&^*&^*&^*-*/&^*&^*&^*&^*&^*&^*&^*&-
*^*&^*&^*&^*&^*&^*&^-*=/*&^*&^*&^*&^
-/*=
'If a previous user inserted comments, their name may appear at the
' top of the comment. Their name may also appear in the Status Bar,
' when you hover over the cell that contains a comment. The following
' macro will replace the old name with a new name.
Sub ChangeCommentName()
'replaces old names in Excel comments
'deletes and reinserts Excel comments
' so new name appears in status bar
'www.contextures.com\xlcomments03.html
Dim ws As Worksheet
Dim cmt As Comment
Dim strOld As String
Dim strNew As String
Dim strComment As String
strNew = "New Name"
strOld = "Old Name"
Application.UserName = strNew
For Each ws In ActiveWorkbook.Worksheets
For Each cmt In ws.Comments
strComment = Replace(cmt.text, strOld, strNew)
cmt.Delete
cmt.Parent.AddComment text:=strComment
Next cmt
Next ws
End Sub
___________________________________________________________________________________
_________________
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
'To insert Excel comments with no User Name, formatted in Times New
' Roman font, use the following macro:
Sub CommentAddOrEditTNR()
'adds TimesNewRoman comment or positions
'cursor at end of existing comment text
'www.contextures.com\xlcomments03.html
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment text:=""
Set cmt = ActiveCell.Comment
With cmt.Shape.TextFrame.Characters.Font
.Name = "Times New Roman"
.Size = 11
.Bold = False
.ColorIndex = 0
End With
End If
SendKeys "%ie~"
End Sub
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
'To insert a comment with no User Name, formatted with red text in the
' first line, blue text in the second line, and bold text after the
' colons, use the following macro:
Sub CommentTextFormatColour()
'adds comment then formats font colour and adds bold
'www.contextures.com\xlcomments03.html
Dim cmt As Comment
Dim str1 As String
Dim str2 As String
Dim lBreak As Long
Dim lNum1 As Long
Dim lNum2 As Long
Dim lNumLen As Long
Dim strFind As String
On Error Resume Next
SendKeys "%ie~"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)(*)
(*!)(*!)(*!)(*!)(*!)(*!)(*!)(*!)(*!)(*!)(*!)(*
'To insert Excel comments with the current date and time, or append
' the current date and time to an existing comment, use the following
' macro:
Sub CommentDateTimeAdd()
'adds Excel comments with date and time,
' positions cursor at end of comment text
'www.contextures.com\xlcomments03.html
With cmt.Shape.TextFrame
.Characters.Font.Bold = False
End With
SendKeys "%ie~"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'If Excel comments have changed size, you can reset them using the
' following code. The first macro resizes all comments on the active
' sheet, and the second macro resizes all comments in the selected
' range.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'The following macro will copy comment text to the cell to the right,
' if that cell is empty.
Sub ShowCommentsNextCell()
'based on code posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'The following macro will add a sheet to the workbook, with a list of
' comments, including the cell address, and cell name, if any.
Sub showcomments()
'posted by Dave Peterson 2003-05-16
Application.ScreenUpdating = False
newwks.Range("A1:D1").Value = _
Array("Address", "Name", "Value", "Comment")
i = 1
For Each mycell In commrange
With newwks
i = i + 1
On Error Resume Next
.Cells(i, 1).Value = mycell.Address
.Cells(i, 2).Value = mycell.Name.Name
.Cells(i, 3).Value = mycell.Value
.Cells(i, 4).Value = mycell.Comment.Text
End With
Next mycell
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
' Dave Peterson showed us that you don't need a loop at all
' just two lines of code on the inside. (misc 2001-11-12)
Sub delShapesOnSht()
'Dave Peterson, misc 2001-11-12, no loop required
If ActiveSheet.Shapes.Count = 0 Then
MsgBox "No Shapes on page for deletion"
Exit Sub
End If
ActiveSheet.Shapes.SelectAll '*** warning DELETE all Shapes
Selection.Delete
End Sub
___________________________________________________________________________________
_________________
'' Dave Peterson provided another example in programming 2001-11-13 '
' to delete shapes with upper left corner within a selection range. '
' -- had -- ActiveSheet.Range("a37:o50")) Is Nothing Then
Sub delShapesSel()
'Delete shapes within selection range,
' Dave Peterson, programming, 2001-11-13
Dim myshape As Shape
For Each myshape In ActiveSheet.Shapes
If Intersect(myshape.TopLeftCell, _
Selection) Is Nothing Then
'do nothing
Else
myshape.Delete
End If
Next myshape
End Sub
___________________________________________________________________________________
_________________
'Missed the specific range in the above, it would be better to use
' Selection. instead of ActivesSheet.Range("a37:o50") -- one person
' used BottomRightCell instead of TopLeftCell due to the way that
' multiple shapes hit one cell. Modify to suit your needs. You can
' manually select all objects on a sheet regardless of what cells are
' selected with Edit, GoTo (Ctrl+G), Special, Objects.
Sub selShapesOnSht()
Dim shp As Shape
For Each shp In ActiveWorkbook.ActiveSheet.Shapes
ans = MsgBox("DELETE Shape" & Chr(10) & shp.Name & " " _
& shp.TopLeftCell.Address & Chr(10) & " -- " _
& shp.AlternativeText, vbYesNoCancel + vbDefaultButton2)
If ans = 2 Then
shp.Select 'Select shape and exit
Exit Sub
End If
If ans = 6 Then shp.Delete 'Delete the shape
Next shp
End Sub
___________________________________________________________________________________
_________________
Code for Particular Shapes:
If sp.AutoShapeType = msoShapeRectangle Then shp.Delete
If sp.AutoShapeType = msoShapeTriangle Then shp.Delete
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'EnumerateSheets - list of sheets from active cell down, uses two columns
'For reordering sheets, I prefer Jeff Web's "ReOrderSheets"
Sub DelHyperLinks()
Selection.Hyperlinks.Delete
End Sub
___________________________________________________________________________________
_________________
Sub delHyperLinksAndText()
'j.Walkenbach version 2000-11-13
'warning clears associated: value, hyperlink, tooltip
Dim hl As Variant
For Each hl In ActiveSheet.Hyperlinks
hl.Parent.Clear
Next hl
End Sub
___________________________________________________________________________________
_________________
Sub RemoveScreenTips()
'David McRitchie, misc, 2003-04-08, misc
Dim cell As Range
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
On Error Resume Next
cell.Hyperlinks(1).ScreenTip = ""
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub DeleteThisSheet()
Dim ans As Variant
Dim saveTrue As Variant
Dim SheetCodeLines As Long
'--requires ref. to the MS VBA Extensibility' library
SheetCodeLines = ActiveWorkbook.VBProject.VBComponents _
(ActiveSheet.CodeName).CodeModule.CountOfLines
If SheetCodeLines > 2 Then
MsgBox ActiveSheet.Name & " -- has " & _
SheetCodeLines & " lines of code (not deleted) "
'-- want to open the sheet code here ---
Sub MakeHyperlinks()
Dim cell As Range
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
With Worksheets(1)
.Hyperlinks.Add Anchor:=cell, _
Address:=cell.Value, _
ScreenTip:=cell.Value, _
TextToDisplay:=cell.Value
End With
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub MakeHyperlinkTo_archiveorg()
Dim cell As Range, nCell As String
For Each cell In Intersect(Selection, _
Selection.SpecialCells(xlConstants, xlTextValues))
' If LCase(Left(Cell.Value, 7)) <> "http://" Then Exit Sub
nCell = "http://web.archive.org/web/*/"
On Error Resume Next
cell.Offset(0, 2) = "aa"
cell.Offset(0, 2).Formula = "=HYPERLINK(""" & nCell _
& """& " & cell.Address(0, 0) & ",""[A]"")"
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub MakeHyperlinkFormulas()
Dim cell As Range
Dim HyperlinkAddress As String, HyperLinkText As String
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
HyperlinkAddress = Trim(cell.Text)
HyperLinkText = Trim(cell.Text)
If HyperLinkText = "" Then GoTo skipit
If HyperLinkText <> "" Then
If InStr(1, HyperlinkAddress, "@") Then
If LCase(Left(HyperlinkAddress, 7)) <> "mailto:" Then
HyperlinkAddress = "mailto:" & HyperlinkAddress
End If
Else
If InStr(1, HyperlinkAddress, ".") = 0 Then GoTo skipit
If LCase(Left(HyperlinkAddress, 7)) <> "http://" Then
HyperlinkAddress = "http://" & HyperlinkAddress
End If
End If
End If
cell.Formula = "=HYPERLINK(""" & HyperlinkAddress & _
""",""" & HyperLinkText & """)"
skipit: HyperLinkText = ""
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub MakeEmailLink()
Dim cell As Range
Dim i As Long
For Each cell In Selection
If InStr(1, cell, "@") > 0 Then
With Worksheets(1)
.Hyperlinks.Add Anchor:=cell, _
Address:="mailto:" & cell.Value, _
ScreenTip:=cell.Value, _
TextToDisplay:=cell.Value
End With
End If
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub BuildTOC()
'listed from active cell down 7-cols -- DMcRitchie 1999-08-14 2000-09-05
' 2000-12-24 to use =HYPERLINK
Dim iSheet As Long, iBefore As Long
Dim sSheetName As String, sActiveCell As String
Dim cRow As Long, cCol As Long, csht As Long
Dim lastcell
Dim qSht As String
Dim mg As String
Dim rg As Range
Dim CRLF As String
Dim Reply As Variant
Dim SheetCodeLines As Long
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
cRow = ActiveCell.Row
cCol = ActiveCell.Column
sSheetName = UCase(ActiveSheet.Name)
sActiveCell = UCase(ActiveCell.Value)
mg = ""
CRLF = Chr(10) 'Actually just CR
Set rg = Range(Cells(cRow, cCol), Cells(cRow - 1 + ActiveWorkbook.Sheets.Count,
cCol + 8))
rg.Select
If sSheetName <> "$$TOC" Then mg = mg & "Sheetname is not $$TOC" & CRLF
If sActiveCell <> "$$TOC" Then mg = mg & "Selected cell value is not $$TOC" &
CRLF
If mg <> "" Then
mg = "Warning BuildTOC will destructively rewrite the selected area" _
& CRLF & CRLF & mg & CRLF & "Press OK to proceed, " _
& "the affected area will be rewritten, or" & CRLF & _
"Press CANCEL to check area then reinvoke this macro (BuildTOC)"
Application.ScreenUpdating = True 'make range visible
Reply = MsgBox(mg, vbOKCancel, "Create TOC for " _
& ActiveWorkbook.Sheets.Count _
& " items in workbook" & Chr(10) & "revised will now occupy up to 10
columns")
Application.ScreenUpdating = False
If Reply <> 1 Then GoTo AbortCode
End If
rg.Clear 'Clear out any previous hyperlinks, fonts, etc in the area
For csht = 1 To ActiveWorkbook.Sheets.Count
Cells(cRow - 1 + csht, cCol) = "'" & Sheets(csht).Name
If TypeName(Sheets(csht)) = "Worksheet" Then
'hypName = "'" & Sheets(csht).Name
qSht = Replace(Sheets(csht).Name, """", """""")
If CDbl(Application.VERSION) < 8# Then
'-- use next line for XL95
Cells(cRow - 1 + csht, cCol + 2) = "'" & Sheets(csht).Name 'XL95
Else
'-- Only for XL97, XL98, XL2000 -- will create hyperlink & codename
Cells(cRow - 1 + csht, cCol + 2) = "'" & Sheets(csht).CodeName
'--- excel is not handling lots of objects well ---
'ActiveSheet.Hyperlinks.Add Anchor:=Cells(cRow - 1 + cSht, cCol), _
' Address:="", SubAddress:="'" & Sheets(cSht).Name & "'!A1"
'--- so will use the HYPERLINK formula instead ---
'--- =HYPERLINK("[VLOOKUP.XLS]'$$TOC'!A1","$$TOC")
'--- double quotes are legal in sheetnames
ActiveSheet.Cells(cRow - 1 + csht, cCol).Formula = _
"=hyperlink(""[" & ActiveWorkbook.Name _
& "]'" & qSht & "'!A1"",""" & qSht & """)"
End If
Else
Cells(cRow - 1 + csht, cCol + 2) = "'" & Sheets(csht).Name
End If
Cells(cRow - 1 + csht, cCol + 1) = TypeName(Sheets(csht))
' -- activate next line to include content of cell A1 for each sheet
' Cells(cRow - 1 + csht, cCol + 3) =
Sheets(Sheets(csht).Name).Range("A1").Value
On Error Resume Next
' sheets(cSht).type
If TypeName(Sheets(csht)) = "Module" Then GoTo byp7
Cells(cRow - 1 + csht, cCol + 6) = Sheets(csht).ScrollArea '.Address(0, 0)
Cells(cRow - 1 + csht, cCol + 7) = Sheets(csht).PageSetup.PrintArea
If TypeName(Sheets(csht)) <> "Worksheet" Then GoTo byp7
Set lastcell = Sheets(csht).Cells.SpecialCells(xlLastCell)
Cells(cRow - 1 + csht, cCol + 4) = lastcell.Address(0, 0)
Cells(cRow - 1 + csht, cCol + 5) = lastcell.Column * lastcell.Row
'--requires ref. to the MS VBA Extensibility' library
SheetCodeLines = ActiveWorkbook.VBProject.VBComponents _
(Sheets(csht).CodeName).CodeModule.CountOfLines
If SheetCodeLines > 2 Then Cells(cRow - 1 + csht, cCol + 8) = SheetCodeLines
byp7: 'xxx
On Error GoTo 0
Next csht
' GoTo AbortCode
'Now sort the results: 2. Type(D), 1. Name (A), 3. module(unsorted)
rg.Sort Key1:=rg.Cells(1, 2), Order1:=xlDescending, Key2:=rg.Cells(1, 1) _
, Order2:=xlAscending, HEADER:=xlNo, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
rg.Columns.AutoFit
rg.Select 'optional
'if cells above range are blank want these headers
' Worksheet, Type, codename
If cRow > 1 Then
If "" = Trim(Cells(cRow - 1, cCol) & Cells(cRow - 1, cCol + 1) _
& Cells(cRow - 1, cCol + 2)) Then
Cells(cRow - 1, cCol) = "Worksheet"
Cells(cRow - 1, cCol + 1) = "Type"
Cells(cRow - 1, cCol + 2) = "CodeName"
Cells(cRow - 1, cCol + 3) = "[opt.]"
Cells(cRow - 1, cCol + 4) = "Lastcell"
Cells(cRow - 1, cCol + 5) = "cells"
Cells(cRow - 1, cCol + 6) = "ScrollArea"
Cells(cRow - 1, cCol + 7) = "PrintArea"
Cells(cRow - 1, cCol + 8) = "Code"
End If
End If
Application.ScreenUpdating = True
Reply = MsgBox("Table of Contents created." & CRLF & CRLF & _
"Would you like the tabs in workbook also sorted", _
vbOKCancel, "Option to Sort " & ActiveWorkbook.Sheets.Count _
& " tabs in workbook")
Application.ScreenUpdating = False
If Reply = 1 Then SortALLSheets 'Invoke macro to Sort Sheet Tabs
Sheets(sSheetName).Activate
AbortCode:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
___________________________________________________________________________________
_________________
Sub BuildTOC_A3()
Cells(3, 1).Select
BuildTOC
End Sub
___________________________________________________________________________________
_________________
Sub SortALLSheets()
'sort sheets within a workbook in Excel 7 -- Bill Manville
'modified to sort all sheets instead of just worksheets
'called by BuildTOC macro you can use another macro...
Dim iSheet As Long, iBefore As Long
For iSheet = 1 To ActiveWorkbook.Sheets.Count
Sheets(iSheet).Visible = True
For iBefore = 1 To iSheet - 1
If UCase(Sheets(iBefore).Name) > UCase(Sheets(iSheet).Name) Then
ActiveWorkbook.Sheets(iSheet).Move Before:=ActiveWorkbook.Sheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub
___________________________________________________________________________________
_________________
Sub Reverse_SortALLSheets()
'sort sheets within a workbook in Excel 7 -- Bill Manville
'modified to sort all sheets instead of just worksheets
'called by BuildTOC macro you can use another macro...
Dim iSheet As Long, iAfter As Long
For iSheet = 1 To ActiveWorkbook.Sheets.Count
Sheets(iSheet).Visible = True
For iAfter = 1 To iSheet - 1
If UCase(Sheets(iAfter).Name) < UCase(Sheets(iSheet).Name) Then
ActiveWorkbook.Sheets(iSheet).Move Before:=ActiveWorkbook.Sheets(iAfter)
Exit For
End If
Next iAfter
Next iSheet
End Sub
___________________________________________________________________________________
_________________
Sub EnumerateAddIns()
Dim i As Long
Worksheets("AddinsSheet").Rows(1).Font.Bold = True
Worksheets("AddinsSheet").Range("a1:d1").Value = _
Array("Name", "Full Name" & " " & Now(), "Title EnumerateAddIns()",
"Installed")
For i = 1 To AddIns.Count
Worksheets("AddinsSheet").Cells(i + 1, 1) = AddIns(i).Name
Worksheets("AddinsSheet").Cells(i + 1, 2) = AddIns(i).FullName
Worksheets("AddinsSheet").Cells(i + 1, 3) = AddIns(i).Title
Worksheets("AddinsSheet").Cells(i + 1, 4) = AddIns(i).Installed
Worksheets("AddinsSheet").Cells(i + 1, 5).Value = i
Next
Worksheets("AddinsSheet").Range("a1").CurrentRegion.Columns.AutoFit
End Sub
___________________________________________________________________________________
_________________
Sub EnumerateSheets_XL95()
'listed from active cell down 2-cols -- DMcRitchie 1999-03-04
'NOT NEEDED AS BuildTOC works for XL95, XL97, XL2000
Application.Calculation = xlManual 'xl97 up use xlCalculationManual
Application.ScreenUpdating = False
cRow = ActiveCell.Row
cCol = ActiveCell.Column
For csht = 1 To ActiveWorkbook.Sheets.Count 'worksheet or sheets
Cells(cRow - 1 + csht, cCol) = "'" & Sheets(csht).Name
Cells(cRow - 1 + csht, cCol + 1) = TypeName(Sheets(csht))
'-- include next line if you want to see cell A1 for each sheet
Cells(cRow - 1 + csht, cCol + 2) = Sheets(Sheets(csht).Name).Range("A1").Value
Next csht
Application.ScreenUpdating = True
Application.Calculation = xlAutomatic 'xl97 up use xlCalculationAutomatic
End Sub
___________________________________________________________________________________
_________________
Sub SortSheets()
'sort worksheets within a workbook in Excel 7 -- Bill Manville
Dim iSheet As Long, iBefore As Long
MsgBox ActiveWorkbook.Worksheets.Count & "Sort Worksheets -- Bill Manville"
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(iSheet).Visible = True
For iBefore = 1 To iSheet - 1
If UCase(Worksheets(iBefore).Name) > UCase(Worksheets(iSheet).Name) Then
ActiveWorkbook.Worksheets(iSheet).Move
Before:=ActiveWorkbook.Worksheets(iBefore)
Exit For
End If
Next iBefore
Next iSheet
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub ReOrderSheets()
' page 48 in "Using Excel VBA" Jeff Webb
'for each sheet in a workbook ...
Dim shtcount As Name, iWrk As Long, iChrt As Long
Dim iMod As Long, iDlg As Long
Sub ShowSheets()
'Unhide sheets -- Tom Ogilvy 17Jun1999
'Should show all sheets as long as the workbook level protection
' is notturned on.
Dim sh As Variant
For Each sh In Sheets
sh.Visible = True
Next
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub Build_SS_Button()
'Build button on spreadshee to invoke macro
'adapted from a posting by "Jim/Nospam" on 30Aug1999
ActiveCell.Select
Selection.Copy
ActiveSheet.Pictures.Add(251, 88, 75, 13).Select
Selection.Interior.ColorIndex = 8
Application.CutCopyMode = False
Selection.OnAction = ActiveCell.Value 'Macro to be invoked
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Function HyperlinkScreenTip(cell)
On Error Resume Next
HyperlinkScreenTip = cell.Hyperlinks(1).ScreenTip
If HyperlinkScreenTip = 0 Then HyperlinkScreenTip = ""
End Function
Function url(cell As Range)
'Tom Ogilvy, programming 1999-04-14 Deja: AN=468281862
'Chip Pearson, programming 1999-04-14 Deja: AN=468345917
'David McRitchie, combined 1999-11-13
'cannot process imbedded link to internal sheet yet ...
If Trim(cell.Formula) = "" Then
url = ""
Exit Function
End If ' 1234567890122
If Left(UCase(cell.Formula), 11) = "=HYPERLINK(" Then
If Left(UCase(cell.Formula), 12) = "=HYPERLINK(""" Then
url = Mid(cell.Formula, 13, InStr(1, cell.Formula, ",") - 13)
Exit Function 'next part for nonquoted first parm
End If
url = Mid(cell.Formula, 12, InStr(1, cell.Formula, ",") - 12)
Exit Function
End If
url = ""
On Error Resume Next
url = cell.Hyperlinks(1).Address
If url = 0 Then url = "'**"
End Function
Function URLHREF(cell As Range)
'As an aid to sorting a list of hyperlinked articles 2004-06-22 xlindex.htm
'="<DD><a href=""" & SUBSTITUTE(pesonal.xls!url(A1),"..\..\..\temp\","") & """>" &
A1 & "</a>"
Dim txt As String
If cell.Font.Bold Then
txt = "<b>" & cell.Text & "</b>"
Else
txt = cell.Text
End If
If url(cell) = "" Then
URLHREF = txt
Else
URLHREF = "<DD><a href=""" & Replace("..\..\..\temp\", "", url(cell)) _
& """>" & txt & "</a>"
End If
End Function
Sub URLCHANGE()
' must reduce the presented string to the
' leading portion that you want to change
' David McRitchie, 2000-11-13, may not work properly
'also see Fix192url macro in builttoc.htm
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim cell As Range, savevalue As String
Dim fromstr As String, tostr As String, fromtst As String
Dim updated As Long
fromstr = "d:\newsite\davemcritchie\excel\"
tostr = "http://www.mvps.org/dmcritchie/excel/"
fromtst = fromstr
updated = 0
Dim urlstr As String, i As Long
fromstr = InputBox("supply from url portion", "URLCHANGE", _
Selection.Hyperlinks(1).Address)
If fromstr = "" Then Exit Sub
If UCase(fromstr) <> UCase(fromtst) Then
tostr = fromstr
tostr = InputBox("supply to url portion, to replace" _
& " " _
& Chr(10) & fromstr, "URLCHANG part 2", tostr)
If tostr = "" Then Exit Sub
End If
For Each cell In Selection
On Error Resume Next
savevalue = cell.Value
Err.number = 0
urlstr = cell.Hyperlinks(1).Address
If Err.number = 0 Then
On Error GoTo 0 'rest back to normal default
If Left(UCase(urlstr), Len(fromstr)) = UCase(fromstr) Then
urlstr = tostr & Mid(urlstr, Len(fromstr) + 1, 9999)
cell.Hyperlinks(1).Address = urlstr
cell.Hyperlinks(1).TextToDisplay = urlstr
cell.Value = savevalue
updated = updated + 1
End If
End If
On Error GoTo 0 'rest back to normal default
Next cell
MsgBox "processed " & updated & " cells"
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub MakeTextOnlyFromHyperlinks()
'David McRitchie, 2000-08-23 worksheet.functions !!
Dim cell As Range
Dim url As String
For Each cell In Selection
If IsEmpty(cell) Then GoTo chknext
url = ""
On Error Resume Next
url = cell.Hyperlinks(1).Address
'MsgBox cell.Address & " -- " & Err.Number & " -- " & URL
If Err.number = 9 Then GoTo chknext
If Trim(url) = "" Then GoTo chknext
cell.Value = url
cell.Hyperlinks(1).Delete
chknext: On Error GoTo 0
Next cell
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub OneSheet_TOC()
'basis Chip Pearson, misc 2000-10-08 CreateIndex
' -- mod. to summarize fromName-ToName, page
'Scans through column A on Sheet1,
'and creates a page index of each "group" of values onto Sheet2.
'Earlier code basis may be Laurent Longre 2000-03-05 programming
' which placed page ?? of ??? right on the spreadsheet.
' http://www.deja.com/=dnc/getdoc.xp?AN=593502826
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim rng As Range
Dim Dest As Range
Dim HPB As HPageBreak
Dim pagenumber As Long
Dim PageRows() As Long
Dim xx As String: xx = ""
Dim bastard1004 As Boolean
ReDim PageRows(0 To Worksheets("Sheet1").HPageBreaks.Count, 0 To 1)
pagenumber = 1
Set rng = Worksheets("Sheet1").Range("A1")
Set Dest = Worksheets("Sheet2").Range("A1")
' From, To, Page, Row
Dest(1, 1) = rng(1, 1)
Dest(1, 2) = rng(1, 1)
Dest(1, 3) = pagenumber
Dest(1, 4) = rng.Row
For Each HPB In Worksheets("Sheet1").HPageBreaks
xx = xx & ", " & HPB.Location.Row
Dest(pagenumber, 2) = rng(HPB.Location.Row - 1, 1)
pagenumber = pagenumber + 1
Dest(pagenumber, 1).Value = rng(HPB.Location.Row, 1)
Dest(pagenumber, 2).Value = rng(HPB.Location.Row, 1)
Dest(pagenumber, 3).Value = pagenumber
Dest(pagenumber, 4).Value = HPB.Location.Row
Next HPB
Worksheets("sheet1").UsedRange
Dest(pagenumber, 2).Value = _
rng.Cells(rng.Cells.SpecialCells(xlLastCell).Row, 1).Value
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
MsgBox Mid(xx, 2, 9999) & ", " & Chr(187) & _
rng.Cells.SpecialCells(xlLastCell).Row & _
Chr(10) & Chr(187) & " Based on LastCell"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub GetAllA1Cells()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Dim iSheet As Long
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
ActiveCell.Offset(iSheet - 1, 0) = Worksheets(iSheet).[A1].Value
ActiveCell.Offset(iSheet - 1, 1) = "'" & Worksheets(iSheet).Name
Next iSheet
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub ResetScrollArea()
ActiveSheet.ScrollArea = InputBox("Supply Scroll area " & _
"or blank out to remove", _
"Supply Scroll Area", ActiveSheet.ScrollArea)
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub time_RunSubFromActiveCell()
'David McRitchie see slowresp.htm & buildtoc.htm for more information
Dim myTime(4) As Double
myTime(1) = timeGetTime()
'... Your code here for timing
Call RunSubFromActiveCell
'... End of Your code here for timing
myTime(2) = timeGetTime()
MsgBox Format((myTime(2) - myTime(1)) / 1000, "#.000") _
& " seconds, "
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub A1TopLeft()
'Application.Goto Reference:=Range(ActiveCell.Address), Scroll:=True
Application.Goto Reference:=Range("A1"), Scroll:=True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub RunSubFromActiveCell()
'-- examples of what you type into a cell for this to work on
' ''macro1'
' ''personal.xls'!upper_case
Dim myTime(4) As Double 'updated 2005-04-29 to include timing
Dim actcell As String, bigmess As String, i As Long
actcell = Trim(ActiveCell.Text)
If InStr(ActiveCell.Text, ".xls'!") And _
Left(ActiveCell.Text, 1) <> "'" Then
MsgBox "you need two single quotes at beginning of " & ActiveCell.Text
End If
i = InStr(ActiveCell.Text, ".xls!")
If i > 0 Then 'mod. 2006-05-24 now compatible with GoToSub and macro menu
'-- must be in form 'book.xls'!macroname to actually run
actcell = "'" & Left(actcell, i + 3) & "'" & Mid(actcell, i + 4, 255)
End If
bigmess = actcell
myTime(1) = timeGetTime()
On Error Resume Next
Err.Clear
If Left(actcell, 1) <> "'" Then
Application.Run "'" & Trim(actcell) & "'"
Else
'-- first single quote does not count it means text field
'-- i.e. ''pesonal.xls'!Test_SP_create_crap
Application.Run actcell
End If
On Error GoTo 0
If Err.number <> 0 Then
actcell = "'" & ActiveWorkbook.Name & "'!" & actcell
myTime(1) = timeGetTime()
Err.Clear
Application.Run actcell
If Err.msg <> 0 Then
bigmess = Err.number & " for " & actcell _
& Chr(13) & Err.Description
Err.Clear
End If
End If
myTime(2) = timeGetTime()
On Error GoTo 0
MsgBox Format((myTime(2) - myTime(1)) / 1000, "#.000") _
& " seconds for " & bigmess
'- examples of tests upper_case ="'2004-11.XLS'!DUMBO_CASE"
'- ''2004-11.xls'!yougotit
'- because this macro runs from personal.xls you must supply bookname.
End Sub
___________________________________________________________________________________
_________________
Sub RunSubFromActiveTest()
'place RunSubFromActiveTest in a cell and run RunSubFromActiveCell
MsgBox "have successfully tested RunSubFromActiveCell"
End Sub
___________________________________________________________________________________
_________________
Sub LinkFix()
' Dana DeLouis 2001-03-19 misc, using an
' Idea From: Chip Pearson
' http://www.cpearson.com/excel/clipboar.htm
'= = = = = = = = =
' VBA Lib.Ref.: Microsoft Forms 2.0 object lib.
' Excel 2000 due to Replace() Function.
'= = = = = = = = =
Dim MyDataObj As New DataObject
MyDataObj.GetFromClipboard
Dim nLnk As String
slnk = Replace(MyDataObj.GetText, _
vbCr, vbNullString)
slnk = Replace(slnk, vbLf, vbNullString)
slnk = Replace(slnk, vbLf, vbNullString)
slnk = Replace(slnk, ">", vbNullString)
slnk = Replace(slnk, " ", vbNullString)
slnk = Replace(slnk, Chr(160), vbNullString)
MyDataObj.SetText slnk
MyDataObj.PutInClipboard
Set MyDataObj = Nothing
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
'MakeHTML_Link has been moved to it's own code module
Sub LinkFix_GoTo()
' Dana DeLouis 2001-03-19 misc,
' Dave Peterson, added FollowHyperlink
' Idea From: Chip Pearson
' www.cpearson.com/excel/clipboar.htm
'= = = = = = = = =
' VBA Library Reference:
' Microsoft Forms 2.0 object lib.
' Excel 2000 due to Replace() Function.
'= = = = = = = = =
Dim MyDataObj As New DataObject
Dim lnk As String
On Error Resume Next
MyDataObj.GetFromClipboard
lnk = Replace(MyDataObj.GetText, _
vbCrLf, vbNullString)
Set MyDataObj = Nothing
ActiveWorkbook.FollowHyperlink _
Address:=lnk, NewWindow:=True
End Sub
___________________________________________________________________________________
_________________
'Sub IdentifyNonFormulaLinks()
' Cells.Hyperlinks.Count
' If Cells.Hyperlink.Count = 0 Then Exit Sub
' cells.hyperlinks.select '<-- not legal
'End Sub
___________________________________________________________________________________
_________________
Sub CB_List()
Worksheets.Add
'Cells(i, 3) = c.enable
Dim i As Long
i = 1
Cells(i, 1) = "Name"
Cells(i, 2) = "Enabled"
Cells(i, 3) = "BuiltIn"
Cells(i, 4) = "Index"
Cells(i, 5) = "Visible"
Cells(i, 6) = "Context"
Cells(i, 7) = "Controls"
Cells(i, 8) = "Creator"
Cells(i, 9) = "Parent"
Cells(i, 10) = "Application"
Dim c As CommandBar
For Each c In CommandBars
On Error GoTo 0
i = i + 1
Cells(i, 1) = c.Name
If c.Enabled = True Then Cells(i, 3) = "True"
On Error Resume Next
Cells(i, 3) = c.BuiltIn
Cells(i, 4) = c.Index
Cells(i, 5) = c.Visible
Cells(i, 6) = c.Context
Cells(i, 7) = c.Controls
Cells(i, 8) = c.Creator
Cells(i, 9) = c.Parent
Cells(i, 10) = c.Application
Next c
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub RevertToLink()
Dim cell As Range
For Each cell In Selection
' On Error Resume Next
cell.Value = cell.Hyperlinks(1).Address
'If cell = 0 Then cell = ""
Next cell
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Sub volatileS()
Dim rng As Range, cell As Range, c As Range
' CELL(), INDIRECT(), INFO(), OFFSET(), NOW(), RAND(), TODAY()
' Set c = Union(Cells.Find("CELL(", , xlFormulas), _
' Cells.Find("INDIRECT(", , xlFormulas), _
' Cells.Find("INFO(", , xlFormulas), _
' Cells.Find("OFFSET(", , xlFormulas), _
' Cells.Find("NOW(", , xlFormulas), _
' Cells.Find("RAND(", , xlFormulas), _
' Cells.Find("TODAY(", , xlFormulas))
' If Not c Is Nothing Then MsgBox "Volatile"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
Function MSGID_asLink(msg)
' David McRitchie 2004-=6-24 as Function
Dim slnk As String
slnk = msg
slnk = Replace(slnk, vbCr, vbNullString)
slnk = Replace(slnk, vbLf, vbNullString)
slnk = Replace(slnk, ">", vbNullString)
slnk = Replace(slnk, "<", vbNullString)
slnk = Replace(slnk, " ", vbNullString)
slnk = Replace(slnk, Chr(160), vbNullString)
slnk = Replace(slnk, "Message-ID:", "news:")
slnk = Replace(slnk, "References:", "news:")
slnk = Replace(Replace(slnk, "#", "%23"), "$", "%24")
MSGID_asLink = slnk
End Function
Function HTMLify(cell As String) As String
' David McRitchie 2005-06-06
Dim slnk As String
slnk = cell
slnk = Replace(slnk, "&", "&")
slnk = Replace(slnk, "<", "<")
slnk = Replace(slnk, ">", ">")
slnk = Replace(slnk, "<", "<")
HTMLify = slnk
End Function
Sub Make_oldhyp()
Dim cell As Range, i As Long, vvv As Variant, lnk As String
Dim L As Long
For Each cell In Intersect(Selection, Cells.SpecialCells(xlCellTypeFormulas))
If UCase(Left(cell.Formula, 12)) = "=HYPERLINK(""" Then
i = InStr(1, cell.Formula, """,")
L = Len(cell.Formula)
lnk = Mid(cell.Formula, 13, i - 13)
With Worksheets(1)
.Hyperlinks.Add Anchor:=cell, Address:=lnk
'cell.Formula = "=" & Mid(cell.Formula, i + 2, L - i - 2)
cell.Value = cell.Value
End With
End If
Next cell
End Sub
___________________________________________________________________________________
_________________
Sub TakeMeBack()
'Brian Wilson, Excel Misc, 2000-08-03
' return to the original cell
'
Worksheets(ThisSheet).Activate
Range(ThisCell).Activate
End Sub
___________________________________________________________________________________
_________________
Sub GoToCell_old()
'David McRitchie 2000-08-03, cont'd based on Brian Wilson
Dim i As Long
ThisSheet = ActiveSheet.Name
ThisCell = ActiveCell.Address
Dim vCell As String
vCell = ActiveCell.Value
i = InStr(1, vCell, "!", 0)
If i <> 0 Then
Sheets(Left(vCell, i - 1)).Activate
Range(Trim(Mid(vCell, i + 1, 99))).Activate
Exit Sub
Else
On Error GoTo TrySheet
Range(vCell).Select
Exit Sub
End If
TrySheet:
On Error GoTo NF
Sheets(ActiveCell.Value).Select
Exit Sub
NF:
MsgBox "Invalid cell, sheetname, or sheetname!cell"
End Sub
___________________________________________________________________________________
_________________
'---------------------------------
Sub GoToCell()
'David McRitchie 2000-08-03, simplified 2001-03-04 by Dana DeLouis
On Error GoTo NF
Application.Goto Range(ActiveCell.Value)
Exit Sub
NF:
MsgBox "GoToCell failed at " & ActiveCell.Address & Chr(10) & _
" with invalid sheetname and/or cell address, attempting " & _
Chr(10) & " to process: " & ActiveCell.Value
End Sub
___________________________________________________________________________________
_________________
Sub GotoTopOfCurrentColumn()
'Graham Tooley" <GrahamTooley@Xtra.co.nz> 23Apr1998
'ActiveCell.EntireColumn.Cells(1, 1).Select
Cells(1, ActiveCell.Column).Select 'J.Campion 2000-03-20
'would like to hit ctrl or shift + and use this, Tom Ogilvy 2000-06-26
'Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
End Sub
___________________________________________________________________________________
_________________
Sub GotoBottomOfCurrentColumn()
'Tom Ogilvy 2000-06-26
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Select
End Sub
___________________________________________________________________________________
_________________
Sub GotoBottomOfColumnA_PlusOne()
'Tom Ogilvy 2000-06-26
Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select
'Tom Ogilvy 2001-04-11
' Dim rng As Range
' Set rng = Cells(Rows.Count, "A").End(xlUp)(2)
' rng.Select
End Sub
___________________________________________________________________________________
_________________
Sub SelectToBottom()
Range(ActiveCell.Address, _
Cells(Rows.Count, ActiveCell.Column).End(xlUp).Address).Select
'-- copy selection to to clipboard
Selection.Copy
End Sub
___________________________________________________________________________________
_________________
Sub GotoRightOfCurrentRow() 'D.McRitchie 2003-12-08 based on Tom Ogilvy
Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Select
End Sub
___________________________________________________________________________________
_________________
Sub GotoRightmostOfCurrentRow()
If Not (IsEmpty(Cells(ActiveCell.Row, Columns.Count))) Then
Cells(ActiveCell.Row, Columns.Count).Select
Exit Sub
End If
Cells(ActiveCell.Row, Columns.Count).End(xlToLeft).Select
'wsFunct: {=ADDRESS(1,MAX(IF(1:1<>"",COLUMN(1:256),"")),4)} t.ogilvy 2000-09-25
End Sub
___________________________________________________________________________________
_________________
'wsFunct to get value of rightmost cell on a row -- Don Guillet 2003-12-09, misc
'One way. Must be array entered (Ctrl+Shift+Enter). copy down
'=OFFSET(A3,0,-1+MAX(ISNUMBER(3:3)*COLUMN(1:256)))
Sub gotolastnotlen0()
Dim lstrow As Long, i As Long 'D.McRitchie 2000-12-04 prog.
lstrow = Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
For i = lstrow To 1 Step -1
If Len(Cells(i, ActiveCell.Column)) <> 0 Then GoTo done
Next i
done:
Cells(i, ActiveCell.Column).Select
End Sub
___________________________________________________________________________________
_________________
Sub GotoHomeOfCurrentRow()
Cells(ActiveCell.Row, 1).Select
'Same as Home key -- as long a no Transition keys
End Sub
___________________________________________________________________________________
_________________
Workbooks.Open(filename:= _
"C:\Documents and
Settings\Administrator\Desktop\XLFDIC01.XLS").RunAutoMacros _
Which:=xlAutoOpen
'Range("[C:\Documents and Settings\Administrator\Desktop\XLFDIC01.XLS]'"
' & Trim(ActiveCell.Value) & "'a1").Select
'Application.Goto Reference:="'" & Trim(ActiveCell.Value) & "'!a1"
Sub GoToCellF()
'David McRitchie testing 2002-10-11
'usage A3: =Data!B14
' macro will take you to Cell at 'data'!B14
'simulates double click of such a formula when options
' tools, options, edit (tab), [uncheck] Edit directly in cell
On Error GoTo NF
Application.Goto Reference:=Application.Range(Mid(ActiveCell.Formula, 2))
Exit Sub
NF:
MsgBox "GoToCell failed at " & ActiveCell.Address & Chr(10) & _
" with invalid sheetname and/or cell address, attempting " & _
Chr(10) & " to process single cell reference in formula: " _
& ActiveCell.Formula
End Sub
___________________________________________________________________________________
_________________
Sub GoToSheet()
'David McRitchie www.mvps.org/dmcritchie/excel/buildtoc.htm
Dim wantedsheet As String
wantedsheet = Trim(ActiveCell.Text)
If wantedsheet = "" Then Exit Sub
On Error Resume Next
If Sheets(ActiveCell.Text) Is Nothing Then
MsgBox "Worksheet " & wantedsheet & " was not found, use RClick on " _
& "Sheet Tab Navigation arrow in lower left corner " _
& "to find desired sheetname."
Else
Sheets(ActiveCell.Text).Select
End If
On Error GoTo 0
End Sub
___________________________________________________________________________________
_________________
Sub GoToTOC()
On Error Resume Next
Sheets("$$TOC").Select
If Err.number <> 0 Then MsgBox "$$TOC Sheet Not Found"
End Sub
___________________________________________________________________________________
_________________
Sub GoToSheetofNextCell()
On Error Resume Next
Sheets(ActiveCell.Offset(0, 1).Value).Select
If Err.number <> 0 Then MsgBox ActiveCell.Offset(0, 1).Value & _
" sheet not found relating to " & ActiveCell.Value
End Sub
___________________________________________________________________________________
_________________
Sub GoToEnteredSheetName()
On Error Resume Next
Err.number = 0
Dim EmpNo As String
EmpNo = InputBox("Enter Sheet name", "Sheet Name Entry", _
ActiveCell.Value, , vbOKCancel)
If EmpNo = "" Then Exit Sub 'empty or hit Cancel
Sheets(EmpNo).Select
If Err.number <> 0 Then MsgBox EmpNo & _
" sheet not found"
End Sub
___________________________________________________________________________________
_________________
Sub GoToNextSheet()
'David McRitchie, 2000-09-07 not posted
'Toolbar button [+]
On Error Resume Next
ActiveSheet.Next.Select
If Err.number = 91 Then
MsgBox Err.number & " You are already in the last worksheet"
End If
End Sub
___________________________________________________________________________________
_________________
Sub GoToPrevSheet()
'David McRitchie, 2000-09-07 not posted
'Toolbar button [-]
On Error Resume Next
'Dim strng As String
'strng = ActiveCell.Address(0, 0)
ActiveSheet.Previous.Select
If Err.number = 91 Then
MsgBox "This is the first worksheet, there are " & _
"no worksheet tabs to left"
End If
'ActiveSheet.Range(strng).Select
End Sub
___________________________________________________________________________________
_________________
Sub GoToLastSheet()
'David McRitchie, 2002-02-27
On Error Resume Next
Sheets(Sheets.Count).Select
End Sub
___________________________________________________________________________________
_________________
Sub GoToSpecificSheet()
'David McRitchie, 2000-11-15 misc
On Error Resume Next
Dim getsheet As String
retry9:
getsheet = InputBox("Supply name of sheet to be selected", _
"Select a Sheet", ActiveSheet.Name)
If getsheet = "" Then Exit Sub 'cancelled
Sheets(getsheet).Select
If Err.number <> 0 Then
MsgBox "sheet """ & getsheet & """ not found, respecify or cancel"
Err.number = 0
GoTo retry9
End If
End Sub
___________________________________________________________________________________
_________________
Sub GoToCustomerSheet()
'David McRitchie 2000-07-15 excel.programming
Dim wantedsheet As String
wantedsheet = Trim(ActiveCell.Value)
wantedsheet = InputBox("Please Supply Customer Name" _
& Chr(10) & "This should match a sheetname", _
"Specify Customer")
If wantedsheet = "" Then Exit Sub
On Error Resume Next
'to goto a cell you still need to slect the sheet first
Sheets(wantedsheet).Select
Sheets(wantedsheet).Range("B14").Select 'Optional
If Err = 9 Then 'actually is subscript out of range
MsgBox "Your worksheet was not found use RClick on " _
& "Sheet Tab Navigation arrow in lower left corner " _
& "to find desired sheetname."
End If
End Sub
___________________________________________________________________________________
_________________
Sub GoToHyperlink()
'selected cell contains Sheet1!Z100
' goto indicated sheet and cell, scroll to display cell in top left corner
Application.Goto Reference:=Range(ActiveCell.Value), Scroll:=True
End Sub
___________________________________________________________________________________
_________________
Sub GoToHTML()
'David McRitchie, 2000-12-13
'documented in http://www.mvps.org/dmcritchie/excel/buildtoc.htm
On Error Resume Next
If Len(Trim(ActiveCell.Value)) = 0 Then Exit Sub
ActiveWorkbook.FollowHyperlink Address:=ActiveCell.Value, _
NewWindow:=False, AddHistory:=True
If Err.number <> 0 Then
MsgBox Err.number & " " & Err.Description & Chr(10) & _
"Tried to bring up file in " & ActiveCell.Address(0, 0) & _
Chr(10) & "Source: " & Err.Source & Chr(10) & _
Chr(10) & "Content: " & Chr(10) & ActiveCell.Text
End If
'Application.WindowState = xlNormal -- what would this do?
End Sub
___________________________________________________________________________________
_________________
H="Sub backupBYDATE()"
Sub backupBYDATE()
'Don Guillett, misc, 2000-05-08 modified filename for date......
'documented in http://www.mvps.org/dmcritchie/excel/backup.htm
Dim dname As String, strTest As String
dname = "c:\mybackup\B" & Format(Now(), "yyyy_mmdd")
strTest = Dir(dname, vbDirectory)
If (strTest = "") Then MkDir (dname)
ActiveWorkbook.SaveCopyAs dname & "\BK_" & ActiveWorkbook.Name
ActiveWorkbook.Save 'also save current file
End Sub
___________________________________________________________________________________
_________________
noSelections:
MsgBox "xxxx"
'// Bug fixed in Excel 2000. (multi-Areas)
'posted 2001-02-28 Dana DeLouis programming
'-- Excel can go back up to the last 4 active sheets.
MsgBox n & " --- " & Application.PreviousSelections(1).Address
If n > 4 Then
MsgBox "Max n for GoBack is 4 !"
Stop: Exit Sub
End If
With Application.PreviousSelections(n)
Workbooks(.Parent.Parent.Name).Activate
Worksheets(.Parent.Name).Activate
Range(.Address).Select
End With
End Sub
___________________________________________________________________________________
_________________
Sub testchad()
Selection.Item(Selection.Count).Activate
' Range("A1:F200").Item(Range("A1:F200").Count).Activate
End Sub
___________________________________________________________________________________
_________________
Sub Select_A1_AllSheets()
Dim wks As String
Dim sht As Worksheet
Application.ScreenUpdating = False
wks = ActiveSheet.Name
On Error GoTo done
For Each sht In Worksheets
Application.Goto Reference:=sht.Range("A1"), Scroll:=True
Next sht
Sheets(wks).Select
done:
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
Sub Select_A1_AllSheets_only()
'if scroll to A1 is not important then no loop needed
Dim wkstr As String
wkstr = ActiveSheet.Name
Worksheets.Select
Range("A1").Select
Sheets(wkstr).Select
End Sub
___________________________________________________________________________________
_________________
Sub GoTo_nextrow_A() 'ctrl+SHIFT+N ctrl+Enter
'-- Advance to Column A of next row
Cells(ActiveCell.Row + 1, 1).Select
End Sub
___________________________________________________________________________________
_________________
Function HasFormula(cell)
'created using a suggestion by Nick Manton nickm@sri.com
' http://www.mvps.org/dmcritchie/excel/formula.htm
HasFormula = cell.HasFormula
End Function
Sub FormulaBox()
'David McRitchie 1998-08-12 1999-08-17
' http://www.mvps.org/dmcritchie/excel/formula.htm
'Place material into MsgBox [ctrl+n]
'Will process ranges of one or more columns
'Application.ScreenUpdating = False
Dim MsgBoxx As String
Dim ix As Long
Dim vGetFormulaI As String, xyx As String
MsgBoxx = "First Character of " _
& Selection.Item(ix).Address(0, 0) & " is """ _
& Left(ActiveCell.Value, 1) & """ =CHR(" _
& Right("0000" & Asc(ActiveCell.Value), 4) & ") or Hex=x'" _
& Hex(Asc(ActiveCell.Value)) & "'" & Chr(10) _
& "Last Character is """ & Right(ActiveCell.Value, 1) _
& """ =CHR(" _
& Right("0000" & Asc(Right(ActiveCell.Value, 1)), 4) & ") or Hex=x'" _
& Hex(Asc(Right(ActiveCell.Value, 1))) & "'" & Chr(10) _
& ActiveCell.Font.Name & " " & ActiveCell.Font.Size _
& " " & ActiveCell.Font.FontStyle _
& ", color: " & ActiveCell.Font.ColorIndex _
& " interior: " & ActiveCell.Interior.ColorIndex _
& Chr(10) & Chr(10)
For ix = 1 To Selection.Count
'Selection.Item(ix).NoteText _ ...
vGetFormulaI = ""
If VarType(Selection.Item(ix)) = 8 Then
vGetFormulaI = "'" & Selection.Item(ix).Formula
Else
vGetFormulaI = Selection.Item(ix).Formula
End If
If Selection.Item(ix).HasArray Then _
vGetFormulaI = "{" & Selection.Item(ix).Formula & "}"
Next
MsgBoxx = MsgBoxx & Chr(10) & "***" _
& Chr(10) & _
LCase(ActiveWorkbook.FullName) & " " & ActiveSheet.Name
'to verify you've seen everything
xyx = MsgBox(MsgBoxx, , _
"FormulaBox: Formula & Format & Text for " _
& Selection.Count & " selected cells")
'Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
Sub FormulaSheet()
'Print information for each non empty cell DMcRitchie 2001-04-30
'Documented in http://www.mvps.org/dmcritchie/excel/formula.htm
'Also see John Walkenbach -- Tip 37 which is formulas only
' ( track this down and see if it was a hyperlink )
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim irow As Long, cell As Range
Dim oSheet As Worksheet, nSheet As Worksheet
Dim oCells As Range
irow = 1
Set oSheet = ActiveSheet
Set nSheet = ActiveWorkbook.Worksheets.Add
nSheet.Name = oSheet.Name & " content at " _
& Format(Now(), "hhmss")
nSheet.Cells(1, 1) = "Cell"
nSheet.Cells(1, 2) = "Text"
nSheet.Cells(1, 3) = "Value"
nSheet.Cells(1, 4) = "Formula"
nSheet.Cells(1, 5) = "NumberFormat"
Function UseFormula(cell)
'David McRitchie Jul 20, 1998 if this is valid will be
'Documented in http://www.mvps.org/dmcritchie/excel/formula.htm
UseFormula = Application.Evaluate(cell.Formula)
'If "'" <> Left(cell.formula, 1) Then UseFormula = "'" & cell.formula
End Function
Sub WhereAmI()
'D.McRitchie, pathname.htm, excel.misc 1999-07-30
MsgBox ActiveWorkbook.FullName & Chr(10) & _
"Microsoft Excel is using " & Application.OperatingSystem
End Sub
___________________________________________________________________________________
_________________
Sub Euro_Format()
Selection.NumberFormat = _
"_(�* #,##0.00_);_(�* (#,##0.00);_(�* "" - ""???_);_(@_)"
End Sub
___________________________________________________________________________________
_________________
Function showAlign(cell As Range) As String
'David McRitchie, 2004-09-15
' based on http://www.mvps.com/dmcritchie/excel/code/xl2htmlx.txt
Dim ca As String
If Trim(Replace(cell.Text, Chr(160), "")) = "" Then
ca = "N/A"
ElseIf cell.HorizontalAlignment = -4138 Then
ca = "Left"
ElseIf cell.HorizontalAlignment = -4108 Then
ca = "Center"
ElseIf cell.HorizontalAlignment = -4131 Then
ca = "Left"
ElseIf cell.HorizontalAlignment = -4152 Then
ca = "Right"
ElseIf IsNumeric(cell) Then
ca = "Right"
Else
ca = "Left"
End If '-4138 left, -4108 center, -4152 right, HTML default left
showAlign = ca
End Function
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="Thread: Clear Memory With Vba Code (and open and close excel from beyond, for
webquery multiple)"
Thread Tools
Search Thread
September 27th, 2006 #1 DOC
Senior Member
Join Date
29th July 2006
Posts
224
Clear Memory With Vba Code
'I have a workbook, with coding that opens many workbooks and performs
' several updates in each one, it seems that for some reason there is
' build up of memory with big files etc, is there a way with code that
' after each workbook has been updated and before the master workbook
' loads the next workbook for update that i can clear all memory,
' similar to closing excel down completly and reopening ?
'I don't think that you will find a solution to the issue that you are
' talking about. I've had simmilar issues in the past and have paid
' more attention to releasing objects when done with them. However, on
' some of my projects and the most pronounced ones are those that
' query databases. If I do many queries, by that I mean I try to run
' many updates to get missed data I find that in the TASK manager the
' memory used for XL continually grows, and that even when the updates
' are done and XL is idle memory (resources ) is not being returned to
' the OS. Now by excessive I mean that typically when my XL starts it
' states 30,000 K and that when I've ran alot of updates I've had that
' number up to 500,00K. The real issue with that is that it then takes
' forever for XL to close and then return that space back to the OS.
But nothing I've done seems to get rid of that situation. Maybe Jack will have more
information.
Regards,
Barry
'it seems if excel is fresh ie closed and re opened the problem is not
' there hence a way to clear the memory between the 9 updates.
'VB:
Sub CONTPAN()
'
Range("i2").Value = Range("j2").Value
Range("i2").NumberFormat = "dd/mm/yyyy"
ActiveWorkbook.Save
Application.Quit
End Sub
___________________________________________________________________________________
_________________
Sub RJ()
MYTIME
Range("D10").Select
If Range("I2").Value = ActiveCell.Offset(0, 6).Value Then
Exit Sub
Else
If ActiveCell.Offset(0, -1).Value <> "Y" Then
Exit Sub
End If
MYDAYS = ActiveCell.Offset(0, 1).Value
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Application.CommandBars("Web").Visible = False
If Range("p3").Value > Range("P28").Value Then
Range("L9").Value = MYDAYS
End If
Application.Run "'1.JTDATA V9-5.XLS'!SELECTUPDATE"
''' GET DATE HERE
MYRECORDS = Range("C11").Value
MYDAY = Range("S1").Value
MYMONTH = Range("p2").Value
MYYEAR = Range("P1").Value
MYTIMENOW = Range("L27").Value
ActiveWorkbook.Save
ActiveWindow.Close
ActiveCell.Offset(0, 5).Value = MYYEAR
ActiveCell.Offset(0, 6).Value = MYDAY
ActiveCell.Offset(0, 7).Value = MYMONTH
ActiveCell.Offset(0, 7).NumberFormat = "dd/mm/yyyy"
ActiveCell.Offset(0, 9).Value = MYRECORDS
ActiveCell.Offset(0, 11).Value = MYTIMENOW
End If
End Sub
___________________________________________________________________________________
_________________
'VB:
Sub MYTIME()
Range("i2").Value = Range("j2").Value
Range("i2").NumberFormat = "dd/mm/yyyy"
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Kind Regards
'Mark
'Location
'Sutton Coldfield - England
'Posts
'8,676
'Re: Saving to another sheet
'try this
'VB:
Sub CopyToLastCell()
'copy values to next blank cell in destination sheet col A
Dim rngMyRange As Range
Set rngMyRange = Sheets("DestinationSheet").Range("A65536").End(xlUp)(2)
Range("B10:J10").Copy
With rngMyRange
.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
Application.CutCopyMode = False
Set rngMyRange = Nothing
End Sub
___________________________________________________________________________________
_________________
'you just need toamend the ranges / sheet names to match your own
'Kind Regards, Will Riley
'Re: Saving to another sheet
'I've managed to get the code working but it comes out down the page
' is it possible to get it across and if so which bit do i need to
' change?
'Kind Regards
'Mark
'Ads By Ozgrid
'Compare Excel | Trading Add-ins For Excel | VBA Code Print | Business
' Spreadsheets | XL Dashboard Reports | XL Sparkmaker
'Jedi
'Join Date
'28th January 2003
'Location
'Sutton Coldfield - England
'Posts
'8,676
'Re: Saving to another sheet
'Sorry, had to head off home.
'Try this
'VB:
Option Explicit
Sub Multi_array_Paste()
Dim rngUnion As Range, rngPaste As Range
Dim myArray() As Variant
Dim x As Variant
Dim i As Integer
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'For e.g. I could potentially lock the cells which have formulas in
' them, and hopefully apply VBA code so that those cells cannot be
' selected.
'Thanks,
'KF
'Ads By Ozgrid
'Compare Excel | Trading Add-ins For Excel | VBA Code Print | Business
' Spreadsheets | XL Dashboard Reports | XL Sparkmaker
'VB:
'Sub LockProtectandHide()
' 'first we unprotect & clear existing setup
' With ActiveSheet
' .Unprotect Password:="password"
' With .Cells
' .Locked = False
' .FormulaHidden = False
' End With
' 'then we can lock the specific cells we want
' With .Range("B6:E8,B2:E4")
' .Locked = True
' .FormulaHidden = True
' End With
' .Protect DrawingObjects:=True, _
' Contents:=True, _
' Scenarios:=True, _
' Password:="password"
' End With
'End Sub
___________________________________________________________________________________
_________________
'The above code will leave everything on the sheet unlocked & unhidden
' apart from the ranges B6:E8 and B2:E4 - you would need to adjust
' these ranges to suit your own... the protection uses a password as
' well although this is optional...
'Kind Regards, Will Riley
'Web Presence:
'Personal: The Trouble With Data
'LinkedIn: Will Riley
'Reply With Quote
'June 24th, 2004 #5 kfotedar
'Member
'Join Date
'24th June 2004
'Posts
'48
'WillR:
'I used the code below which works fine only thing is that it is
' designed to work for just one cell.i.e. A1. Is it possible to make
' it work for a number of cells or even like a range name. I tried
' that didn't work.
'VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngLocked As Range
Set rngLocked = Intersect(ActiveCell, Range("Cell_Formula"))
If Not rngLocked Is Nothing Then
Range("B1").Select
MsgBox "Sorry this cell is locked", vbInformation, _
Target.Address(0, 0)
End If
Set rngLocked = Nothing
'Kind Regards, Will Riley
'Thanks WILLR!
'The code worked, the reason I don't want to go the sheet protection
' route is because that locks other features on the worksheet. The
' code you gave worked like a charm.
'AARON:
'Your code was good too, but I could not get it to work , I guess it's
' beacuse my range (formula_cell) is non-contigous, while your range
' in the example you provide was contigous? Just my guess. But thanks,
' for continous ranges will use what you provided.
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Sub HyperlinkXLSFiles()
'With the use of Excel VBA Macro code we can create a list of
' Hyperlinked Excel Workbook names on any Excel Worksheet. The code
' below can be used on any version of Excel, 2000 or higher. The only
' changes needed are to the file paths used. The part of the code that
' reads: .Filename = "Book*.xls" has been commented out but can be
' uncommented if you wish to restrict the list to that of specific
' Excel Workbook name. Note also the code 'as is' restricts the list
' to only Excel Workbooks. However, this can be any of the File types
' listed below;
'Ensure the active Worksheet at the time of running the code is clean
' so as to not over write existing data.
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\MyDocuments\Testings"
.FileType = msoFileTypeExcelWorkbooks
.FoundFiles(lCount), TextToDisplay:= _
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="Excel VBA: Loop Through a Folder of Excel Workbooks With the FileSearch Method"
'With the use of Excel VBA Macro code we can loop through a Folder on
' ones Hard-drive and work on all Excel Workbooks within it. The code
' below can be used on Excel 97 - Excel 2003 (For Excel 2007, see
' Excel 2007 Alternative To File Search). The only changes needed are
' to the file paths used. The part of the code that reads: .Filename =
' "Book*.xls" has been commented out but can be uncommented if you
' wish to restrict the list to that of specific Excel Workbook name.
' Note also the code 'as is' restricts the list to only Excel
' Workbooks. However, this can be any of the File types listed below;
Sub RunCodeOnAllXLSFiles()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
wbResults.Close SaveChanges:=False
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
___________________________________________________________________________________
_________________
'msoFileTypeAllFiles
'msoFileTypeBinders
'msoFileTypeCalendarItem
'msoFileTypeContactItem
'msoFileTypeCustom
'msoFileTypeDatabases
'msoFileTypeDataConnectionFiles
'msoFileTypeDesignerFiles
'msoFileTypeDocumentImagingFiles
'msoFileTypeExcelWorkbooks
'msoFileTypeJournalItem
'msoFileTypeMailItem
'msoFileTypeNoteItem
'msoFileTypeOfficeFiles
'msoFileTypeOutlookItems
'msoFileTypePhotoDrawFiles
'msoFileTypePowerPointPresentations
'msoFileTypeProjectFiles
'msoFileTypePublisherFiles
'msoFileTypeTaskItem
'msoFileTypeTemplates
'msoFileTypeVisioFiles
'msoFileTypeWebPages
'msoFileTypeWordDocuments
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="Thread: Update Fields From .txt File"
'
'Hi,
'I need to update some fields in my excel sheet from a .txt file
' (comma or space separated), based on matching values of a key field
' in both files. I do not want to import the file into excel and do a
' vlookup.
'I am thinking of a macro that prompts the user for the file location
' ( txt file) and then scans the txt file and updates the fields.
'Would anyone know how to go about doing this or have any code I can
' use?
'Re: Update Fields From .txt File
'if you know at what position in a line of the text file your key word
' is to be found and also the the position of the value to be written
' in your xl file then you can use something like this:
'VB:
FName = path_and_filename_of_txt_file
Open FName For Input Access Read As #1
While Not EOF(1)
Line Input #1, WholeLine
If Mid(WholeLine, 2, 6) = SEARCHKEY Then
Cells(RowNdx, ColNdx).Value = Mid(WholeLine, 22, 7)
RowNdx = RowNdx + 1
End If
Wend
'The above writes every found value onto a new line. That might have
' to be altered for you of course.
'In formulae, depending on your locale, you might have to replace ;
' with , or vice versa.
'Reply With Quote
'March 19th, 2007 #3 aadarsh
'Senior Member
'Join Date
'12th January 2005
'Location
'Singapore
'Posts
'201
'Re: Update Fields From .txt File
'
'i have been able to use this code. however, need help to solve 2 more
' problems:-
'Thanks!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
'
'I'm trying to create a hyperlink to another cell in the same
' workbook by creating the hyperlink destination address using
' formulas in other cells. This works perfectly in a new workbook but
' fails as soon as the workbook is saved. I feel like I've tried
' everything including specifying the route using the
' =CELL("filename") formula. Any ideas what I'm doing wrong?
'I've used this appoach in the past when I need to create dynamic
' formula-driven hyperlinks within a workbook.
'Instead of hyperlinks I use VBA & the Worksheet_BeforeDoubleCclick
' event. If your links are on sheet1 then place this code into the
' sheet1 module.
'VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean
#41;
goto_sheet = 'formula
goto_cell = 'formula
On Error Resume Next
Select Case Target.Font.Underline
Case xlUnderlineStyleSingle
If Target.Font.ColorIndex = 41 Then
Application.Goto Worksheets(goto_sheet).Range(goto_cell)
End If
End Select
End Sub
___________________________________________________________________________________
_________________
'This example is similar but has the formulas (to derive sheetname &
' cell name) in coumns D&E of the activerow.
'VB:
sheet_col = "D"
cell_col = "E"
goto_sheet = Cells(ActiveCell.Row, sheet_col).Value
goto_cell = Cells(ActiveCell.Row, cell_col).Value
On Error Resume Next
Select Case Target.Font.Underline
Case xlUnderlineStyleSingle
If Target.Font.ColorIndex = 41 Then
Application.Goto Worksheets(goto_sheet).Range(goto_cell)
End If
End Select
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'eg sheet1 a4 = cossie how do i make sheet4 sheet tab name equal
' cossie?
'
' Feb 19th, 2003, 08:51 PM #2
'phantom1975
'MrExcel MVP
'
'
'Join Date: Jun 2002
'Location: Omaha, Nebraska
'Posts: 3,910
'I'm afraid that there is no really good way to do what you would like
' to do. You can create a macro to do this, but it would only work
' once. For example:
'Sheets("Sheet4").Name = Sheets("Sheet1").Range("A4").Value
'This would work fine the first time. After that, "Sheet4" no longer
' exists. You would need something a bit more elaborate! First of all,
' you would need to pick a cell in Sheet4 to put the following formula:
'=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-SEARCH("]",
' CELL("filename",A1)))
'Then you would need to name this cell using the NAMED CELL RANGE.
' Let's call it SheetNameValue. You can then use the following code in
' Sheet1:
Sheets([SheetNameValue].Value).Name = Target.Value
End If
End Sub
___________________________________________________________________________________
_________________
'Does this help?
'Yes!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="WriteFormulasToWord"
'a macro that actually pulled the formulas and placed them in a Word
' document for you. The following Excel macro will do just that:
Sub WriteFormulasToWord()
Dim Wrd As New Word.Application
Dim CellTxt As String
Dim CellAddr As String
Dim SRow As Long
Dim SCol As Long
Wrd.Visible = True
Wrd.Documents.Add
'In addition, this macro will not work properly unless you set up
' Excel macros to handle references to Word objects. You do that by
' following these steps within the VBA Editor:
'Choose References from the Tools menu. VBA displays the References
' dialog box. (See Figure 3.)
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Most users have discovered that Excel has an option that lets you
' display formulas directly in their cells: Choose Tools Options,
' click the View tab, and select the Formulas checkbox. However, Excel
' doesn't provide a way to generate a concise list of all formulas in
' a worksheet. The VBA macro below inserts a new worksheet, then
' creates a list of all formulas and their current values.
'NOTE:
'The Power Utility Pak includes a more sophisticated version of this
' subroutine, plus several other auditing tools.
Sub ListFormulas()
Dim FormulaCells As Range, Cell As Range
Dim FormulaSheet As Worksheet
Dim Row As Integer
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
'You could instruct your users to put the morefunc folder in their
' home directory and to activate the add-in from that folder.
'
' Jan 2nd, 2003, 10:06 PM #13
'Tom Urtis
'MrExcel MVP
'Join Date: Feb 2002
'Location: San Francisco, California USA
' Posts: 10,569
' Perhaps this macro may help. Place it in a standard VBA module, then
' activate the sheet containing the formulas, and run the macro.
' It will create a new sheet, list your formulas, and separate them by
' sheet name and cell reference with the help of Andrew Poulsom's
' formulas. The root idea for the macro structure came from something
' similar posted by Dave Peterson last year, so thanks to him also.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub ListFormulas()
Application.ScreenUpdating = False
With Worksheets.Add(after:=Sheets(Sheets.count))
Application.DisplayAlerts = False
On Error Resume Next
Worksheets(Left(SourceSheet.Name, 22) & "_Formulas").Delete
On Error GoTo 0
Application.DisplayAlerts = True
counter = 0
On Error Resume Next
AllFormulas = SourceSheet.Cells.SpecialCells(xlCellTypeFormulas).Cells.count
For Each cell In SourceSheet.Cells.SpecialCells(xlCellTypeFormulas)
.Range("B4").Offset(counter, 0).Value = cell.Address(0, 0)
.Range("C4").Offset(counter, 0).Value = cell.Formula
.Range("D4").Offset(counter, 0).Value = cell.FormulaR1C1
counter = counter + 1
Next cell
On Error GoTo 0
.Range("A:A").ColumnWidth = 10
.Range("B:H").Columns.AutoFit
.Rows.AutoFit
End With
SourceSheet.Activate
Application.Goto Range("A1"), True
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
' __________________
'Tom Urtis
'Microsoft MVP - Excel
'
' Jan 3rd, 2003, 02:57 AM #14
'Andrew Poulsom
'MrExcel MVP
'Moderator
' Here is the VBA equivalent of my formulas:
'Code:
Sub Test()
Dim Rng As Range
Dim Frm As String
Dim WF As WorksheetFunction
Dim Sh As String
Dim Ref As String
' *** Change sheet and range references to suit ***
Set Rng = Worksheets("Sheet1").Range("B5")
Frm = Rng.Formula
Set WF = WorksheetFunction
Sh = WF.Substitute(Mid(Frm, 2, WF.Find("!", Frm, 1) - 2), "'", "")
Ref = Right(Frm, Len(Frm) - WF.Find("!", Frm, 1))
MsgBox "Sheet is " & Sh
MsgBox "Cell reference is " & Ref
End Sub
___________________________________________________________________________________
_________________
'
' Thanks Tom, I will test your code in a later stage.
' Andrew, thanks for the code, but I got an error while running the
' code:
' However the Find function is available to VBA, still I don't know
' where is the error with this line. Should we repeat the "WF." before
' each function in theis code?
' Excello
'
' Jan 3rd, 2003, 09:08 AM #17
'Andrew Poulsom
'MrExcel MVP
'Moderator
'
'
'
'Join Date: Jul 2002
' Posts: 50,789
' What is the formula in cell B5 on Sheet1? Find will fail if the
' formula does n
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|
'If your filenames are all the same length, then you can simply use
' the RIGHT function to pull out the last characters. (This formula
' assumes the full path and file name is in cell A1.)
'=RIGHT(A1,11)
'Note that the formula uses the SUBSTITUTE function twice. In each
' case it replaces the backslashes (\) with something else. The first
' time it replaces all of them with an ASCII value of 1 and the second
' it replaces them with nothing (an empty string) so that it can
' determine how many backslashes were in the original path. The MID
' function is used to locate (with the help of FIND and the SUBSTITUTE
' functions) the location of the last backslash in the path and return
' everything after that point.
'A shorter formula can be used if you are sure that the filename will
' never be more than 99 characters long:
'=TRIM(RIGHT(SUBSTITUTE(A2,"\",REPT(" ",100)),99))
'This formula replaces all the backslashes with 100 spaces, grabs the
' right-most 99 characters from the resulting string (that would be
' the filename with a bunch of spaces in front of it) and then trims
' off all the spaces.
'If you want to use a macro you can create one that steps backward
' through the path until it locates the last backslash. It then
' returns everything after the backslash. The following example starts
' in cell B1, examining everything to the right of the cell (cell A1)
' and then starts pulling out file names. It steps through all the
' cells in column A and puts the file name, if any, in column B.
Sub GetFileName1()
Dim Delimiter As String
Dim Target As String
Dim sFile As String
Dim J As Integer
Dim iDataLen As Integer
Delimiter = "\"
Range("B1").Select
Do While ActiveCell.Offset(0, -1).Value <> ""
Target = ActiveCell.Offset(0, -1).Value
iDataLen = Len(Target)
sFile = "Delimiter Not Found"
For J = iDataLen To 2 Step -1
If Mid(Target, J, 1) = Delimiter Then
sFile = Right(Target, iDataLen - J)
Exit For
End If
Next J
ActiveCell.Formula = sFile
ActiveCell.Offset(1, 0).Select
Loop
End Sub
___________________________________________________________________________________
_________________
'You could also use a much shorter version of a macro, provided you
' can use the Split function. This function was introduced in the
' version of VBA provided with Excel 2000, and it will pull a string
' apart based upon a delimiter you specify and stuff the parts into an
' array. This example shows the solution implemented as a user-defined
' function.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Richard has a workbook that he's been using for a while, and it has
' quite a few names in it (named ranges, named formulas, etc.). He
' wonders if there is an easy way to find names that are not used at
' all, as he'd like to get rid of those names.
'There is no built-in way to get rid of these unused names. You can,
' however, create a macro that will do the trick for you. This is most
' easily done by using the Find method to figure out which names have
' references that can be "found." If the reference cannot be found,
' then the name is not in use.
Sub RidOfNames()
Dim myName As Name
Dim fdMsg As String
'The macro steps through all the elements of the Names collection and
' does a search for each name. If the name cannot be found, then the
' name is deleted. When the macro is completed, it displays a message
' box that lists the names that were removed from the workbook.
'If you would rather not create your own macro, you can opt to use a
' free add-in by Jan Karel Pieterse. The add-in, called Name Manager,
' allows you to (guess what?) manage names better than you can do with
' native Excel. One of the functions it provides is the ability to get
' rid of names that are no longer needed. You can find the add-in here:
'http://www.jkp-ads.com/OfficeMarketPlaceNM-EN.asp
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'It is possible to do this using macros, but you may not really want
' to do that from a business or user-oriented perspective. For
' instance, let's say that a user has three workbooks open on his
' system, so that comparisons can be made between them. It is possible
' to get "tied up" with two of the workbooks for quite a while, with
' the third one being the one that triggers a shutdown. Excel's VBA
' isn't terribly discriminating�when a workbook is closed, it is
' typically the one which has focus at the current time.
'To start, add the following code to a standard macro module. Note
' that there are three routines to be added:
'The third routine, ShutDown, is the one that actually closes the
' workbook. It is only invoked if the OnTime method expires, at the
' end of an hour. It closes the workbook without saving any changes
' that may have been made.
'The next routines (there are four of them) need to be added to the
' ThisWorkbook object. Open the VBA Editor and double-click on the
' ThisWorkbook object in the Project Explorer. In the code window that
' Excel opens, place these routines:
'The first two routines are triggered when the workbook is opened and
' when it is closed; they start the timer and turn it off. The other
' two routines are executed automatically whenever a worksheet is
' recalculated or whenever someone makes a selection in the workbook.
' Both are good indicators that someone is using the workbook (it is
' not inactively open). They stop the timer and then restart it, so
' that the one-hour countdown starts over.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
'Once you start writing Excel macros, it is easy to get quite a few of
' them in a workbook. At some point you may want to generate a list of
' macros in your workbook. There is no intrinsic way within Excel to
' create a list of macros. You can, however, create a macro that will
' list your macros. (Sort of sounds redundant, doesn't it?)
'As an example, consider the following macro, which uses the sendkeys
' function to garner all the macro names and place them in a worksheet:
Sub ListMacros()
Dim VBComp As VBComponent
Dim VBCodeMod As CodeModule
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer
Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.[a1] = "Macro"
StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
'In order to use this macro, you must make sure you have the Microsoft
' VBA extensibility reference set. To do this, follow these steps:
'In the VBA Editor, choose References from the Tools menu. The
' References dialog box is displayed. (See Figure 1.)
'When you run the macro, it adds a new worksheet to your workbook, and
' then lists the names of all the macros in all the modules in the
' workbook.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Sub GetSheets()
Dim J As Integer
Dim NumSheets As Integer
NumSheets = Sheets.Count
For J = 1 To NumSheets
Cells(J, 1) = Sheets(J).Name
Next J
End Sub
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'If you are writing a VBA macro in Excel, you may have a need to allow
' the user to specify a file they want from the disk. Fortunately, you
' can access the standard Open dialog box from within VBA and use it
' to return just a file name. The following example subroutine shows
' how this is done:
Sub GetFName()
Dim FName As Variant
Dim Msg As String
FName = Application.GetOpenFilename()
If FName <> False Then
Msg = "You chose " & FName
MsgBox Msg
Else
'Cancel was pressed
End If
End Sub
___________________________________________________________________________________
_________________
'When you run this macro, you will see the standard Open dialog box
' used in Excel. The user can select a file, and when they click on
' Open, the file name (including the full path) is assigned to the
' variable FName. If the user clicks on the Cancel button, then FName
' is set equal to False. (Thus the test for that in the code.)
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Sub Import()
Sub Import()
Dim sFile As String
Dim sUnwanted As String
Dim sDelim As String
Dim iRow As Integer
Dim iCol As Integer
Dim bBadRecord As Boolean
Dim iTemp As Integer
sFile = "d:\data.txt"
sUnwanted = "bad text"
sDelim = ","
iRow = 1
While Not EOF(1) 'Scan file line by line
iCol = 1
Line Input #1, sBuffer
'As an example, let's assume that you have a data file named
' Customers.txt. This file contains all your customer records, but you
' don't want to import the records for customers with addresses inside
' the United States. Further, the records in the data file use a tab
' character between each field. In this case, you would only need to
' make the following changes to the variables at the beginning of the
' macro:
' sFile = "d:\Customers.txt"
' sUnwanted = "United States"
' sDelim = Chr(9)
'Once you run the macro, the current worksheet contains just the
' desired data.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
{ ( � [ � | � ] � ) } { ( � [ � | � ] � ) { ( � [ � | � ] � ) { ( � [ �
| � ] � )
{ ( � [ � | � ] � ) { ( � [ � | � ] � ) { ( � [ � | � ] � )
{ ( � [
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
Sub Auto_Close()
Dim intStatusState As Integer
intStatusState = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "Examining transactions."
DetermineTransactions
Application.StatusBar = "Posting transactions."
PostTransactions
Application.StatusBar = False
Application.DisplayStatusBar = intStatusState
End Sub
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+^(_+
^(_+^(_+^(_+^
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'You might think that you could use Paste Special to perform the task,
' but that doesn't work. If you copy the original cells and then use
' Edit | Paste Special | Comments, then only the comments are pasted
' to the target cells. They are still comments, and not text in cells,
' which goes against Hector's goal.
'The only way to handle this type of extraction is to use a macro. The
' following, when run on a selection of cells, will extract the
' comments, move the comment text, and then delete the original
' comment.
Sub CommentsToCells()
Dim rCell As Excel.Range
Dim rData As Excel.Range
Dim sComment As String
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
___________________________________________________________________________________
_________________
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
'When you create macros in VBA, you can easily incorporate the use of
' message boxes. These are typically used to convey information to the
' user and to get some rudimentary input. You include message boxes by
' using the MsgBox command. The following portion of a macro creates a
' very simple message box:
'MsgBox "The Macro is Done"
'You can also add symbols to your message boxes by including one a
' symbol type code as part of your MsgBox invocation. These symbols
' are used extensively in many Windows dialog boxes. The following
' four types of symbols can be used:Type Symbol
'16 Stop sign
'32 Question mark in a circle
'48 Exclamation point in a circle
'64 Information symbol (lowercase i in a circle)
'So far the MsgBox command has been used as a statement, but you can
' also use it as a function. If you do so, you can use it to get
' simple input from the user. To make the MsgBox function more useful,
' Excel allows you to display more clickable buttons in the dialog box
' besides the OK button. This is done by adjusting the type code,
' which was used for the symbols displayed in the message box. The
' following are the different button combinations you can display in
' your message box:Type Button Types
'1 OK, Cancel
'2 Abort, Retry, Ignore
'3 Yes, No, Cancel
'4 Yes, No
'5 Retry, Cancel
'To use the buttons, you simply add the value of the button type to
' the value you want used for the symbol. In the previous example, you
' used the code of 48 to display the exclamation point symbol. If you
' wanted to also include the Abort, Retry, Ignore buttons, you simply
' change the code to 50, which is 48 (the symbol code) plus 2 (the
' button code).
'When using buttons in this way, the MsgBox function returns a value
' indicating which button the user chose. The buttons return, from
' left to right, -1, 0, and 1. Thus, if you use a button code of 3,
' then -1 would mean the user chose Yes, 0 would mean No, and 1 would
' mean Cancel.
)
*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*
_)*_)*_)*_)*_)*
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Jeremy posed a problem that is based on two cells, A1 and C1. These
' cells are designed to contain inches and millimeters, respectively.
' Jeremy wants a way that someone could enter a value in A1 and it
' would be converted to millimeters in C1. Conversely, they could
' enter a value in C1 and it would be converted to inches in A1.
'Doing the conversion, of course, isn't the real issue. The problem is
' that if someone enters a value in A1, that value will overwrite any
' formula that may be in that cell, and mean that any subsequent value
' entered in cell C1 would not give the required conversion in the
' previously overwritten A1.
'Of course, if you want to really limit yourself to two cells, then
' you will need to resort to using macros to do the actual conversion.
' You can use a worksheet event that is triggered every time a cell
' value is changed, and the event handler could check to see if the
' cell being changes is either A1 or C1. The following macro gives an
' example of how this could work:
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Wendy has a worksheet that has quite a bit of data in it, with the
' main data in the range C3:P312. She would like to have a macro that,
' if she clicks a cell in this data range, would put an "x" into the
' cell.
'There is a problem with this approach, however: Not only will the
' SelectionChange event trigger when you click on a different cell, it
' also triggers if you use the keyboard to move from one cell to
' another in the worksheet. This means that if you use the keyboard to
' move about the worksheet you will leave a tail of "x" characters in
' each cell you transit.
'One way around this is to change the event that triggers the check
' and change of the cells. While Excel has no "click" event, there is
' a "double click" event. This means that you can change the cell on
' which you double click, as shown here:
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
Dim rInt As Range
Dim rCell As Range
Set rInt = Intersect(Target, Range("C3:P312"))
If Not rInt Is Nothing Then
For Each rCell In rInt
rCell.Value = "x"
Next
End If
Set rInt = Nothing
Set rCell = Nothing
Cancel = True
End Sub
___________________________________________________________________________________
_________________
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Macros are a wonderful way to expand the functionality of a program such as Excel.
You may, however, want to expand that functionality even more by executing a DOS
batch file from your macro. Excel allows you to do this by using the Shell command.
The general syntax for the command is as follows:
dRetVal = Shell("myfile.bat", mode)
Within the quote marks you can place the full path name and file name of the file
you want to execute. On some systems you may experience problems if you use a path
name with the file specification. (This seems to crop its ugly head if you have
complex path names or if the path name includes spaces.) If you have this problem,
then simply use the ChDir command just prior to Shell in order to change the
directory used by Excel. You can then execute Shell using just a file name.
The mode indicator simply tells Excel how you want the window opened for the file
to appear. The mode indicator can be any of the following:Value Variable Nam
Meaning
0 vbHide Window is hidden and has focus.
1 vbNormalFocus Window is the normal size and has focus.
2 vbMinimizedFocus Window is minimized and has focus.
3 vbMaximizedFocus Window is maximized and has focus.
4 vbNormalNoFocus Window is normal size, but doesn't have focus.
6 vbMinimizedNoFocus Window is minimized, but doesn't have
focus.
The Shell command returns a value that indicates the program ID of the file you
executed, or else a zero. If a zero is returned, then there was an error executing
the file.
You should remember that when you use Shell, the target file is executed right
away, and it is executed independently of Excel. This means that the next macro
command, in your Excel macro, is immediately executed without waiting for the Shell
target file to finish. Unfortunately, there is no way around this behavior.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'Tassos would like to have Excel play an audio file when the value in
' a certain cell exceeds a threshold. For instance, when the value in
' a cell exceeds 999 he would like a particular sound file to be
' played.
'Next you can create a short little macro that will actually play the
' sound file. Assuming that the sound file is in the same directory as
' the workbook, the following code will work. (You should modify the
' code so that it contains the proper filename and location.)
Sub PlayWAV()
WAVFile = ThisWorkbook.Path & "\MyAudioFile.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub
___________________________________________________________________________________
_________________
'Now, whenever the value in Cell C5 changes and exceeds 999, the audio
' file will play one time. If the values is changed to less than 999,
' nothing plays. If the value changes to another value that exceeds
' 999, the sound file will play again.
'For additional ideas on playing audio files, check out these sites:
'http://www.j-walk.com/ss/excel/tips/tip87.htm
'http://www.cpearson.com/excel/PlaySound.aspx
'You should note, as well, that you can get Excel to play a system
' sound by using data validation. Simply set up the validation
' criteria (described in other issues of ExcelTips) and then, on the
' Error tab, specify whether you want Excel to stop, warn, or inform
' the user. When a value is entered in the cell that does not fit the
' criteria, a dialog box is displayed and the system sound is heard.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="Code:HyperlinkFileList() "
End Function
Sub HyperlinkFileList()
'Macro purpose: To create a hyperlinked list of all files in a user
'specified directory, including file size and date last modified
'NOTE: The 'TextToDisplay' property (of the Hyperlink object) was added
'in Excel 2000. This code tests the Excel version and does not use the
'Texttodisplay property if using XL 97.
End Sub
___________________________________________________________________________________
_________________
'How to use:
'Copy above code.
'In Excel press Alt + F11 to enter the VBE.
'Press Ctrl + R to show the Project Explorer.
'Right-click desired file on left (in bold).
'Choose Insert -> Module.
'Paste code into the right pane.
'Scroll to find the "Function Excludes" function
'Review the line starting "X=Array". Remove any extension you DO want
' to see in the list, and add any extension you DON'T want to see in
' the list. (For example if you don't want to see Word documents, add:
' ,"doc" after the "zip" portion of the line)
'Press Alt + Q to close the VBE.
'Save workbook before any other changes.
'
'Test the code:
'Select (or create) a blank worksheet
'From Excel, run macro 'HyperlinkFileList' by pressing Alt+F8.
'Choose a directory from the explorer window that pops up, and click
' Okay
'If you have not selected a valid directory ('My computer', 'Network
' Neighborhood', etc...) you will be asked if you would like to try
' again
'Your list will be created
'
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Option Explicit
Sub PasteFC()
Application.ScreenUpdating = False
Dim rWhole As Range
Dim rCell As Range
Dim ndx As Integer
Dim FCFont As Font
Dim FCBorder As Border
Dim FCInt As Interior
Dim x As Integer
Dim iBorders(3) As Integer
iBorders(0) = xlLeft
iBorders(1) = xlRight
iBorders(2) = xlTop
iBorders(3) = xlBottom
If rng.FormatConditions.Count = 0 Then
ActiveCondition = 0
Else
For ndx = 1 To rng.FormatConditions.Count
Set FC = rng.FormatConditions(ndx)
Select Case FC.Type
Case xlCellValue
Select Case FC.Operator
Case xlBetween
If CDbl(rng.Value) >= CDbl(FC.Formula1) And _
CDbl(rng.Value) <= CDbl(FC.Formula2) Then
ActiveCondition = ndx
Exit Function
End If
Case xlGreater
If CDbl(rng.Value) > CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlEqual
If CDbl(rng.Value) = CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlGreaterEqual
If CDbl(rng.Value) >= CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlLess
If CDbl(rng.Value) < CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlLessEqual
If CDbl(rng.Value) <= CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlNotEqual
If CDbl(rng.Value) <> CDbl(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case xlNotBetween
If CDbl(rng.Value) <= CDbl(FC.Formula1) Or _
CDbl(rng.Value) >= CDbl(FC.Formula2) Then
ActiveCondition = ndx
Exit Function
End If
Case Else
Debug.Print "UNKNOWN OPERATOR"
End Select
Case xlExpression
If Application.Evaluate(FC.Formula1) Then
ActiveCondition = ndx
Exit Function
End If
Case Else
Debug.Print "UNKNOWN TYPE"
End Select
Next ndx
End If
ActiveCondition = 0
End Function
'There are three procedures in this solution. The last procedure,
' ActiveCondition, is designed to return a number indicating which of
' the conditions in a conditional format is currently in effect. This
' routine was found at Chip Pearson's site, as indicated in the first
' comment of the function. (No sense in re-inventing the wheel. :>))
'The center function, NewFC, is simply used to determine which of two
' values is valid. The procedure you actually run, however, is
' PasteFC. Simply select the cells you want to convert to explicit
' formatting, then run the procedure. It checks each cell you selected
' for which formatting condition is active, determines the formatting
' of that condition, and then applies it to the cell. Finally, the
' conditional formatting for the cell is removed.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'
'Craig is developing a worksheet and wants to know if there is a way
' to specify the maximum number of characters that can be entered in
' any given cell. He doesn't want to use Data Validation to impose the
' limitation.
'There is no way to do this directly in Excel without (as Craig
' mentions) using Data Validation. There are a few things you can try
' to achieve the desired effect, however. First, you can using a
' formula to check the length of any cell, and then display an error
' message, if desired. For instance, if the cells you want to check
' are in column C, you could use a formula such as the following:
'=IF((LEN(C1)>15),"Cell is Too Long","")
'Place the formula in the cell to the right of the cell being checked
' (such as in cell D1), and then copy it down as many cells as
' necessary. When an entry is made in C1, and if it is more than 15
' characters, then the message is displayed.
'If such a direct approach is undesirable, then you'll need to use
' macros to do the checking. The following is a simple example that is
' triggered whenever something is changed in the worksheet. Each cell
' in the worksheet is then checked to make sure it is not longer than
' 15 characters. If such a cell is discovered, then a message box is
' displayed and the cell is cleared.
ExitHandler:
Application.EnableEvents = True
Set rCell = Nothing
Set rng = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub
___________________________________________________________________________________
_________________
'To use this macro, you simply need to change the value assigned to
' iChars (represents the maximum length allowed) and the range
' assigned to rng (currently set to A1:A10). Because the macro checks
' only for changes within the specified range, it is much faster with
' larger worksheets than the macro that checks all the cells used.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'
'Richard has a workbook that he's been using for a while, and it has
' quite a few names in it (named ranges, named formulas, etc.). He
' wonders if there is an easy way to find names that are not used at
' all, as he'd like to get rid of those names.
'There is no built-in way to get rid of these unused names. You can,
' however, create a macro that will do the trick for you. This is most
' easily done by using the Find method to figure out which names have
' references that can be "found." If the reference cannot be found,
' then the name is not in use.
Sub RidOfNames()
Dim myName As Name
Dim fdMsg As String
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'
'Steven has a worksheet that has lots of text in it. In the cells in
' column A he wants to delete everything that may occur before a given
' sequence of characters, such as everything before =XX=. There may be
' multiple instances of these characters in each cell, but Steven only
' wants to delete everything before the first occurrence.
'One way to do this is to use a formula. For instance, the following
' formula will evaluate whatever is in cell A1 and simply return
' everything up to the =XX= characters. If the characters are not
' found in the cell, then the entire cell is returned:
'=RIGHT(A1,IF(ISERROR(FIND("=XX=",A1,1)),
'LEN(A1),LEN(A1)-FIND("=XX=",A1,1)+1))
'If you want, instead, to not return the first occurrence of =XX=, all
' you need to do is change the +1 near the end of the formula to -3.
'If you prefer a macro-based solution you could use a routine like the
' following. It examines all the cells that are currently selected and
' then deletes everything before the =XX= sequence.
Sub DeleteToSequence()
Dim rCell As Range
Dim sSeq As String
Dim x As Long
sSeq = "=XX="
For Each rCell In Selection
x = InStr(rCell.Value, sSeq)
If x > 0 Then
rCell.Value = Mid(rCell, x)
End If
Next
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="This can be done with a formula, but it quickly becomes unwieldy. For instance,
the following formula can be used to put dashes between the letters of whatever you
type into cell A1:
=CHOOSE(LEN(A1),A1,LEFT(A1,1) & "-" & RIGHT(A1,1),
LEFT(A1,1) & "-" & MID(A1,2,1) & "-" & RIGHT(A1,1),
LEFT(A1,1) & "-" & MID(A1,2,1) & "-" & MID(A1,3,1) & "-"
& RIGHT(A1,1),LEFT(A1,1) & "-" & MID(A1,2,1) & "-"
& MID(A1,3,1) & "-" & MID(A1,4,1) & "-" & RIGHT(A1,1),
LEFT(A1,1) & "-" & MID(A1,2,1) & "-" & MID(A1,3,1)
& "-" & MID(A1,4,1) & "-" & MID(A1,5,1) & "-" & RIGHT(A1,1))
This particular example of a formula will only work on text up to six characters in
length. Thus, it would work properly for "house", but not for "household". The
formula could be lengthened but, again, it would quickly become very long.
A better approach is to use a macro to do the conversion. If you want to insert the
dashes right into the cell, you could use a macro such as this:
Sub AddDashes1()
Dim Cell As Range
Dim sTemp As String
Dim C As Integer
Application.Volatile
sTemp = ""
For C = 1 To Len(Src)
sTemp = sTemp + Mid(Src, C, 1) + "-"
Next
AddDashes2 = Left(sTemp, Len(sTemp) - 1)
End Function
To use this function you would use the following in your worksheet:
=AddDashes2(A1)
If you want to make sure that the function is a bit more robust, you could modify
it so that it handles multiple words. In such an instance you would not want it to
treat a space as a "dashable letter." For example, you would want the routine to
add dashes to "one two" so it came out as "o-n-e t-w-o" instead of "o-n-e- -t-w-o".
The following variation on the function will do the trick:
Function AddDashes3(Src As String) As String
Dim sTemp As String
Dim C As Integer
Application.Volatile
sTemp = ""
For C = 1 To Len(Src)
sTemp = sTemp + Mid(Src, C, 1)
If Mid(Src, C, 1) <> " " And
Mid(Src, C + 1, 1) <> " " And
C < Len(Src) Then
sTemp = sTemp + "-"
End If
Next
AddDashes3 = sTemp
End Function
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Your VBA procedure might need to present the user with a list of fonts to choose
from. Or, you may need to determine if a particular font is installed. The simplest
way to access the installed font list is to get the fonts from the Font control on
the Formatting toolbar. The Font control contains a dropdown list of installed
fonts, and you can write VBA code to retrieve that list from the control.
Displaying font names
The procedure listed below displays a list of installed fonts in Column A of the
active worksheet. It uses the FindControl method to locate the Font control on the
Formatting toolbar. If this control is not found (i.e., it was removed by the user)
a temporary CommandBar is created and the Font control is added to it.
Sub ShowInstalledFonts()
Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728)
The function below uses the same technique as the ShowInstalledFonts procedure. it
returns True if a specified font is installed.
Function FontIsInstalled(sFont) As Boolean
' Returns True if sFont is installed
FontIsInstalled = False
Set FontList = Application.CommandBars("Formatting").FindControl(ID:=1728)
' If Font control is missing, create a temp CommandBar
If FontList Is Nothing Then
Set TempBar = Application.CommandBars.Add
Set FontList = TempBar.Controls.Add(ID:=1728)
End If
For i = 0 To FontList.ListCount - 1
If FontList.List(i + 1) = sFont Then
FontIsInstalled = True
On Error Resume Next
TempBar.Delete
Exit Function
End If
Next i
The statement below demonstrates how to use this function in a VBA procedure. It
displays True in a message box if the user's system contains the Comic Sans MS
font.
MsgBox FontIsInstalled("Comic Sans MS")
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Since there are several examples on this page, this seems about as good a place as
any to include the following information.
Row = activecell.row
Col = activecell.column
Find Column letters of the selected cell
Columns run A through IV (1-256), length is 1 for < 27, or 2 above 26.
= Left(ActiveCell.Address(0, 0), (ActiveCell.Column < 27) + 2)
Even simpler is one from Dana DeLouis, 2001-03-04 in programming
= Split(ActiveCell.Address, "$")(1) 'For Column Letter
= Split(ActiveCell.Address, "$")(2) 'For Row Number
Finding the Relative Address of a cell.
Assumes you have A1 addressing: Tools --> Options --> General --> with R1C1 off
Place address of cell into itself as a text entry -- see MarkCells example above.
Selection.Item(iX) = "'" & Selection.Item(iX).AddressLocal(0, 0)
Followup example:
Sub test10()
'will display CV as equivalent of 100, and 28 for AB
C = 100
MsgBox "Alpha equivalent for Col " & C & " is " & _
Left(cells(1, C).AddressLocal(0, 0), _
Len(cells(1, C).AddressLocal(0, 0)) - 1)
MsgBox "Numeric equivalent for AB is " & Range("ab" & "1").Column
End Sub
___________________________________________________________________________________
_________________
Worksheet Example of converting column number to a Letter
Will convert numbers 1 to 256 to Excel column letters A to IV.
256 IV =LEFT(ADDRESS(1,A1,4),LEN(ADDRESS(1,A1,4))-1)
1 A =LEFT(ADDRESS(1,A2,4),LEN(ADDRESS(1,A2,4))-1)
2 B =LEFT(ADDRESS(1,A3,4),LEN(ADDRESS(1,A3,4))-1)
3 C =LEFT(ADDRESS(1,A4,4),LEN(ADDRESS(1,A4,4))-1)
4 D1 =ADDRESS(1,A5,4) **ADDRESS(row,column)**
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
=AFTLAST(E22)
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
MarkCells() will destroy previous contents within Selection RANGE. Each cell will
be identified with it's address when MarkCells was invoked. The examples in
Samples below, and in Delete Cells/Rows in Range, based on empty cells utilized
MarkCells. Some similar items of interest are AAA_ZZZ macro will generate AAAA up
to ZZZZ within a selected range(s). Also of interest is a UDF by Myrna Larson that
increments strings See related area below.
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
Note: As written the selection area must include cell A1, and the original
selection area is really the entire rows. This is practical as long as there are
not more than 256 rows selected because of the longstanding 256 column limitation
in Excel. This macro was written to normalize a spreadsheet that could best be
views sideways and had rotated cells that became available in XL97. Until
rewritten arrangement or presence of cells not in selection is undefined.
Sub RotateCW()
'Rotate Clockwise: 1) Rotate rows, 2) TRANSPOSE & delete orig
'David McRitchie, 2000-02-07 MISC., documented in
' http://www.mvps.org/dmcritchie/excel/join.htm
'Cell A1 must be in Selection !!!!!
'must formatting and Formulas are preserved
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual 'pre XL97 xlManual
Dim i As Long
Dim nRows As Long
Dim nCols As Long
Dim curRange As Range
Dim abc As String
Set curRange = Selection
nRows = Selection.Rows.Count
nCols = Selection.Columns.Count
If nRows > 256 Then GoTo done
nRows = InputBox("Specify number of rows, suggesting " & nRows, _
"Selection of Number of rows to Rotate", Selection.Rows.Count)
nRows = nRows + 1 'adjustment for inserts
For i = nRows To 2 Step -1
Rows(1).Select
Selection.Cut
Rows(i).Select
Selection.Insert Shift:=xlUp
Next i
'Have flipped the rows, next step is to TRANSPOSE data with copy
abc = "1:" & nRows - 1
Range(abc).Select
i = MsgBox("Flipping of Rows Completed. Do you want to continue " & _
"with a TRANSPOSE using COPY?", vbOKCancel, "Question")
If i <> 1 Then GoTo done
Selection.Copy
Cells(nRows, 1).Select 'TRANSPOSE to
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False _
, Transpose:=True
Range(Cells(1, 1), Cells(nRows - 1, 256)).Delete
done:
Application.Calculation = xlCalculationAutomatic 'pre XL97 xlAutomatic
Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
Separate first word (term) from remainder of cell (#septerm)
SepTerm() separates the first word (term) from remainder of cell. Remainder goes
to next column. SepTerm() can be used as a reversal of Join and is a more
forgiving option than Data --> Text to Columns. SepTerm() Can be used to separate
the street number from the rest of the street name. Can also be used to separate a
term from a definition.
Only a single column need to be selected. The next column will be tested that it
contains a blank. A check will be made that no cells contain data in the adjacent
column to the right, but you can override this. Even after overriding data will
not be split if it will remove content from the adjacent column. See Samples below
for an example of usage. Suggested shortcut key [Ctrl+t]
Sub SepTerm()
'David McRitchie 1998-08-05 [Ctrl+t] documented in
' http://www.mvps.org/dmcritchie/excel/join.htm
'Separate the first term from remainder, as in separating
'street number as first item from street & remainder
'Work on first column, cell to right must appear to be blank
'--Application.ScreenUpdating = False
'On Error Resume Next
iRows = Selection.Rows.Count
Set lastcell = cells.SpecialCells(xlLastCell)
mRow = lastcell.Row
If mRow < iRows Then iRows = mRow 'not best but better than nothing
For ir = 1 To iRows
If Len(Trim(Selection.Item(ir, 1).Offset(0, 1))) <> 0 Then
iAnswer = MsgBox("Found non-blank in adjacent column -- " _
& Selection.Item(ir, 1).Offset(0, 1) & " -- in " & _
Selection.Item(ir, 1).Offset(0, 1).AddressLocal(0, 0) & _
Chr(10) & "Press OK to process those than can be split", _
vbOKCancel)
If iAnswer = vbOK Then GoTo DoAnyWay
GoTo terminated
End If
Next ir
DoAnyWay:
For ir = 1 To iRows
If Len(Trim(Selection.Item(ir, 1).Offset(0, 1))) <> 0 Then GoTo nextrow
checkx = Trim(Selection.Item(ir, 1))
L = Len(Trim(Selection.Item(ir, 1)))
If L < 3 Then GoTo nextrow
For im = 2 To L
If Mid(checkx, im, 1) = " " Then
Selection.Item(ir, 1) = Left(checkx, im - 1)
Selection.Item(ir, 1).Offset(0, 1) = Trim(Mid(checkx, im + 1))
GoTo nextrow
End If
Next im
nextrow:
Next ir
terminated:
'--Application.ScreenUpdating = True
End Sub
___________________________________________________________________________________
_________________
Considerations in working with data from HTML sources
The macro above does not include replacing a non breaking space character ( )
typically used in HTML, with a normal space. You can achieve the replacement with
Worksheet
Ctrl+H, Replace: Alt+0160, With: (space)
with macro code.
Selection.Replace What:=CHR(160), Replacement:=CHR(32), LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
A worksheet solution for the above. This will leave the original column and the two
new columns wns will be dependent on the original. You can remove the dependency
by using copy and paste special value. That's why I use a macro.
=LEFT(A3,FIND(" ",A3)-1)
=MID(A3,FIND(" ",A3)+1,LEN(A3)-FIND(" ",A3))
or if only interested in the street, to remove the number at the beginning, if
present, before the first space, use. [Rag Dyer 2005-04-23]
=IF(ISERR(--LEFT(A1,FIND(" ",A1))),"",LEFT(A1,FIND(" ",A1)-1)) -- number if
present
=IF(ISERR(--LEFT(A1,FIND(" ",A1))),A1,MID(A1,FIND(" ",A1)+1,100)) -- street
name
or to include considerations for char(160) but not errors (Peo Sjoblom, misc, 2002-
02-17) -- No consideration for errors is all the more reason to use macros.
for street numbers (leftmost word):
=LEFT(TRIM(CLEAN(SUBSTITUTE(A1,CHAR(160)," "))),SEARCH("
",TRIM(CLEAN(SUBSTITUTE(A1,CHAR(160)," "))))-1)
Will paste comments from a copied block of cells to another block of cells.
Sub pastespecialcomments()
Selection.PasteSpecial Paste:=xlPasteComments, _
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
___________________________________________________________________________________
_________________
Could use this one along with the formula to comment, and to a agrouped sheet
before splicing
^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^__^_
_^__^__^__^__^__^
����������������������������������
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
����������������������������������
v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V__v__V_
_v__V__v__V__v__V
'David McRitchie
' http://www.mvps.org/dmcritchie/excel/code/beeps.txt
' http://www.mvps.org/dmcritchie/excel/funstuff.htm
'You can record your own voice for a wave (.wav) file
' My test "Value in A1 is 100" for 2.5 seconds was 64KB
'From the window help file "Sound Recorder" use Click here button
' actually invokes sndrec32.exe
' 1) Record with round button at far right, turns RED when recording
' 2) Stop Recording with black square, just like on a VCR
' 3) Play with the PLAY button, or double click on the speaker
' 4) File, Save As, (save in appropriate file)
' Exit in normal fashion [x]
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��+��
+��+��+��+��+��+
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<*^/<
*^/<*^/<*^/<*^/<*
����������������������������������
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
����������������������������������
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''
'''' 'What this means is that the current formula in the cell is going to%
1-d'''''''''''''
'''' ' be placed at each location where it says "_form_". Edit the formula%
2-d'''''''''''''
'''' ' template to match your need and click OK.%
3-d'''''''''''''
''''
''''''''''''''''
'''' 'Because sFormulaTemplate is declared as Static, the utility remembers%
4-d'''''''''''''
'''' ' the template for a next time you use it.% 5-
d'''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''
_______________________________________________________________________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''
'''' 'Dimensioning variables for use with Options Explicit. If you have%
1-d'''''''''''''
'''' ' simply used Dim xyz as variant you can find out the actual type that%
2-d'''''''''''''
'''' ' you used with MsgBox typename(xyz) so you can replace variant by%
3-d'''''''''''''
'''' ' its actual type. Similarly MsgBox TypeName(Selection) can be use%
4-d'''''''''''''
'''' ' to tell what the selection is. [See Slow Response]% 5-
d'''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="Sub ExportToTextFiles()"
Sub ExportToTextFiles()
Dim FirstRow As Integer, LastRow As Integer, MyFileName As String, MyRow As
Integer, MyStr As String
' change these values to the start row and end row for your notes.
' if you have to use a range you'll need a double loop below
FirstRow = 1
LastRow = 4
If DoesFileExist(MyFileName) = 0 Then
Open MyFileName For Output As #1 ' create a new file and record if file does
not exist
Else
Open MyFileName For Append As #1 ' append a record if file does already exist
End If
MsgBox "Done"
End Sub
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
H="
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
If you are writing a VBA macro in Excel, you may have a need to allow the user to
specify a file they want from the disk. Fortunately, you can access the standard
Open dialog box from within VBA and use it to return just a file name. The
following example subroutine shows how this is done:
Sub GetFName()
Dim FName As Variant
Dim Msg As String
FName = Application.GetOpenFilename()
If FName <> False Then
Msg = "You chose " & FName
MsgBox Msg
Else
'Cancel was pressed
End If
End Sub
___________________________________________________________________________________
_________________
When you run this macro, you will see the standard Open dialog box used in Excel.
The user can select a file, and when they click on Open, the file name (including
the full path) is assigned to the variable FName. If the user clicks on the Cancel
button, then FName is set equal to False. (Thus the test for that in the code.)
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
___________________________________________________________________________________
_________________
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@_(@
_(@_(@_(@_(@_(@_(
_)*(_)*-)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_)*_
)*_)*_)*_)*_)*_)*
(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^_(^
_(^_(^_(^_(^_(^_(^
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!^/!
^/!^/!^/!^/!^/!^/!^
!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?>*<!^?
>*<!^?>*<!^?>*<!^?>
/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/][/]
[/][/][/][/][/][/
\
+\_\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=-\=
-\=-\=-_\=-\=-\-
}?}?}/}/}/]/}/]/]?}/}/}/}?}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}?]/}
?]/}?]/}?]/}?]/}?
><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)(><)
(><)(><)(><)(><)(><
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!{}!
{}!{}!{}!{}!{}!{}!{}!
___________________________________________________________________________________
_________________
|+__|+__|+__|+__|+__|+__|+__|+__|+__|+__|+___|+__|+___|+___|+____|+__|+__|+___|
+___|+_||+__|+__|+__|+_
_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)(_)
(_)(_)(_)(_)(_)(_
*&*^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*&^*
&^*&^*&^*&^*&^