ࡱ> ~ r KJ   !"#$%&'()*+,-./0123456789:;<=?IABCDEFGH>mLMnOYQRSTUVWXNZ[\]^_`abcdefghijklopqstuv{xyz|}Root Entry F ᤅ;Workbook XCBQ_VBA_PROJECT_CUR"@K܂ ᤅ  !"#$%&'()*+,-./012345678:;=>?@ABCDEFGHIJKLMNPQRUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ChemFormat2Le2Le2Le (Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorageChemicalFormat( p(<<<<<  ɀ\pAsst. Prof. Udo Schnupf, PhD Ba= ThisWorkbook=hL,<X@"1Arial1Arial1Arial1Arial"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)'""$"#,##0.00_);[Red]\("$"#,##0.00\)7*2_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).))_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)?,:_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)6+1_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_) 0.0000                + ) , *  ` Sheet1bPb^I/B+B.BBiK#^] _br0 i bJD 0 b0]]#^ _br0 ib ( Ir0bb0BS0bt00@ GDa^n00֪b 00Ԣ0֪b֪bجb0֪bجbtb0ԪbPbPercent0]< ZS0dbhbΝ0\db0ZT0_T0=l0Te0qL00hq0b]0 bb NJT0e0YT0L0YT0LNJT0bbk0 %4bȆ0bc=s00{=s0:0db lw04Ьbbb0b  ɀ L  dMbP?_*+%"b??NJU>@ Sheet2 rU X$`h$)`l $i`p$p<)-;G`:t] F(-;G`:t]x84A#(-;G`:t])-;G`:t] 4VBA;+@ThisWorkbook=c__SRP_8@__SRP_9 9`Xth ME$ F HX L H 8 P p L , D LX D B 8 X  p z zx F @ ` @HP *X " : (08@H $Px    D D 0 D@ & DO  F P  p $    .;  8 8 P Poh 2P * HP X ` h x  4878808H ` h       D(6*  X h &x$Z Z V0P X ` h p  M  & $    ,( 2H(     ,  < H hp\  L *82kh     B .0*`J0] : BPC ;T'-;G`:t]F&-;G`:t]xA/46#&-;G`:t]'-;G`:t]]eJLl$ HD@<@[LSS L*L" LL>"(LH(LD(L>(0LL L$*\Rffff*d73e593777$*\Rffff*d63e593777*\R3*#4c*\R1*#20b*\R0*#b*\R0*#c*\R1*#16a*\R1*#b8*\R3*#48*\R1*#a7*\R1*#208*\R3*#30*\R3*#4d*\R3*#4b*\R3*#49*\R1*#169*\R0*#1*\R0*#11*\R3*#4a*\R3*#2f*\R0*#10*\R0*#16$*\Rffff*da3e593777*\R1*#ac`$$$$$$8$8$8$$$b @@@  $E tb$HH@RLXZ`8$&``oh$( (xh`,t .8phH$`2l@4pj`6d`8``:\ <XD$`@V BPP8@$ F LX<$` lklDD (x $`t@r`6l`8h`:dollo <xPTh $X:=ms$`(,kp8@"404@<@b88@D@HAH  B8<<@b"DD@8` (@H @D @4 @$  @( X  @  ady @X @@ @ @@0 @ O H 0AUI@p @ H@X <F@ @ @ @ @ pera@0 tuff@H ton.@` Usto@x the @ w.i@ arro@ " @ onen@ @  <@@  bH@8  @P | @h x @ t @ p 2@ l @ h tCbd^h "@@ d @ ` @( \ )@@ X |G@T F@p D @4 F 0Q 0`|G V|G $rG@ ,  fFOS@(O Fp fAV) OF@& 7G@ @ <@ r<@@  F@  @  LF@ q@ LF@ F  @ p  RL "@ ` @X \ @ L @( < @, @ @   ` $ p   `D$ @  @@ `` @p $h`X`8$@@ (d^@ @ @ @ @ @0 @H @` @x @ @ @ @ @ @ @  @8 @P @h @ @ @ @ @ @ @| @l 8XRL@t @pp @(` @@P @@ @0 @, XX"Dz*>@ $p' E  <4  8 :P 0   "    HI " H`hpx F D F  .h F H H( &p   8    DO P ` h p& *      4( "`    *    D9 00 `  .8h  3  3  4  3  h3! x! !! !!! !HI! 4##"## >#6O$ P$8`$$  F$)$  $ $ %$@ This workbook contains the procedures to install and remove theA chemistry formatter button on the tool bar, and to start and endE the class module that controls whether or not the button is enabled.A The workbook contains a "storage toolbar", that holds the button to be added.S How to add the toolbar: 1) Create the toolbar.E 2) Attach it to the add-in file (from the toolbar customize menu).% 3) Save and close the add-in file.= 4) A copy of the toolbar was created, and must be removed.F Delete the toolbar from Excel (from the toolbar customize menu).!> The position of the button is stored in "DocumentProperties".; These properties were initially added to the workbook with the following statements.ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ToolbarName", Value:="Formatting", LinkToContent:=False}ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ControlIndex", Value:="9", LinkToContent:=False{ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeNumber, Name:="ParentType", Value:="0", LinkToContent:=FalsesThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Tag", Value:="", LinkToContent:=FalsetThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Name", Value:="", LinkToContent:=False?ThisWorkbook.Save ' They aren't accessible until it is saved. For setting the tooltip:commandbars("ChemFormat").controls(1).tooltiptext="Chemistry Formatter" & vbcr & " applies sub- and superscripts" & vbcr & " converts * to ; makes arrows elegant" & vbcr & " converts 1E5 to exponential notation"YZ$ Initial location of toolbar button.Z@Z@Z@8Z@Z@4 Adds a "Chemistry Formatter" button to the toolbar.Z Z8ZPZpZZZZZZDim cbcs As CommandBarControlsZ Z@Jp Clean up.> If the button is already present, delete it. (This cleans up> if the user created a duplicate, or, perhaps, if the computer crashed.)= This doesn't find the button in the storage toolbar; that button has a different tag. RnTChemFormatCKTSUV L!N%P.( (? Check to make sure the add-in isn't already loaded (perhaps as a different version) !X', . Z .!\ .!$Chem Formatter Excel .!X ,1 An installed "Chem Formatter" addin that differs1 from this addin is already installed. Exit with a message.$ !%/3=/An attempt is being made to load a second copy `/of the Chemistry Formatter. The first copy is: `  .!, ` stored in `  .!b ` `The add-in trying to load is: `  !, ` stored in `  !b ` `8To prevent problems, one of the above should be removed. d"Chemistry Formatter Already LoadedA@^, Don't run the rest of this install routine.$ ThisWorkbook.Close AddIns(ThisWorkbook.BuiltinDocumentProperties(1)).Installed = False ' Doesn't work. Check mark remains in add-ins list.uhhh . (B@fhp. Retrieve the previous location of the button.  ToolbarName7h!j' ControlIndex7h!j' ParentType7h!j' Tag7h!j'"Name7h!j'$n Make local copies. '2 '4 '6 "'8 $':> Validate the position in case the parent control was deleted. 6 Parent is a toolbar. < L!N- Find the destination toolbar. <! 2 <!l Toolbar exists and is enabled.'@ 4 2 L%N!n!p T Prevent control index from being too large (could happen if controls were deleted). 2 L%N!n!p '4hhrh <a Parent is a popup menu. r 6 8 L!N%P.B B B!>! :  The parent popup menu exists. B.F'@ 4 F!n!p , Prevent control index from being too large. F!n!p '4h`hXhPhH Use defaults% Can get here if user deleted button. @6 Place the button after the "Merge & Center" button on the "Formatting" toolbar.'6 Formatting'2 a45gidm40d' C Forces addin to be saved even if button is deleted twice in a row. E (The "undo" info in sheet1 wasn't being cleared if this is omitted.)# Find the "Merge & Center" control. RnT 2 L%N%P.( ( '4a@ (!t '4h h< Create the chemistry formatter button. It is stored in the' "ChemFormat" toolbar of this workbook. 6 Place it on a toolbar.E<@ 2 L%Nx 4z ChemFormat L%N%nB@vChemFormatCKTSU 4 2 L%N%n(V3 Make sure the command bar containing the chemistry; formatter icon is visible so that this add-in can be used. 2 L%N!| 2 L%N(|h0a Place it on a popup menu. F!>x 4z ChemFormat L%N%nB@vChemFormatCKTSU 4 F!>%n(V Make the parent bar visible. F!~!n  F!~!~!~!n a( F!~!~!~!| F!~!~!~(| Else2 User has place the button in a popup menu located4 in another popup menu. Let the user handle whether* or not the parent command bar is visible.h8h0a( F!~!| F!~(|hhhuJ #)17!An unexpected error has occurred: `  Error number  ! `  ! ` /This occurred while loading the button handler. ` `#Let me know and maybe I can fix it. `#Chris King, cking@trojan.troyst.edu ` `Last Updated:   ` `"The latest version can be found at ` spectrum.troyst.edu/~cking/ d A@^ Keep tryingl`B Removes the toolbar button and saves the location, if it changed.ZZZZZZ @ To understand what's happening here, you have to know that a> menu popup control contains a second control: a command bar.@ The controls on the popup have as their parent the command bar,( which has as its parent the popup menu.? Custom popup menus all have an ID of 1. The command bar ofB a custom popup is given a distinguishing name when it is created,A such as "Custom Popup 110993829". This name isn't accessible to the user, except through code.`1 Unload the "handle button enabled" class module. /. Find the button. RnTChemFormatCKTSUV L!N%P.( ( (5~5n 5~cbcButton.Parent.Parent5T'6#sToolbar = "" ' Not used for popup.5V'8n 5': Command bar namea '65'-sTag = "" ' Not used by toolbar or menu bar.sName = "" ' "hp nh # Record its position and delete it.5t'C@fn h      6  8 " : $) Button was moved. Save its new location 7!B@! Removes undo info.  ToolbarName7h(j  ControlIndex7h(j 6 ParentType7h(j 8Tag7h(j :Name7h(j9L Could put this value in sToolbar, but would make the code harder to follow.C@nx ap  (hX uP H #)17!An unexpected error has occurred: `  Error number  ! `  ! ` 1This occurred while unloading the button handler. ` `#Let me know and maybe I can fix it. `#Chris King, cking@trojan.troyst.edu ` `Last Updated:   ` `"The latest version can be found at ` spectrum.troyst.edu/~cking/ d A@^. If error occurs, exit without doing anything.l8Z88 When Excel starts, the storage toolbar is left enabled. RChemFormatCKTSUstorage L!N%P.< < ChemFormat L%NB@fhx? Start the class module, which enables and disables the button. !L / B@lAttribute VB_Name = "ThisWorkbook" Bas0{00020P819-0C$0046} |CreatablFalse ^PredeclaIdTru "@ExposeTemplateD0eriv$eCustomiz2$' { w| contains the proc edureo  tall and remove ' chemistry formatter ton $tool bar,to startend!ss modu!thatGro@ls wher or notNA0is enidh. $T\ga "ragZF"",hold;CB#o be addeA' How @-3@: 1) gBxC ol#'@ 2) @ach i@-oB@@-in fi@9(from cie menu)`3) Sa@\_cnlM 4@Mpy ofwas cedam9r9, De\led9 )Excel !,EAaitiA"Glb@A"Docu@:tProperties"2݀D were@=@yge*{wi thfoll owingAtes9'}.c.Add Type:=mso ySng, a:="TJJValu@"FcaLinkToCkent:=s?__D! fIndexh9_$!!Numbe@{DPnt$01m/Tag(? ? S>B{ e [ren'ccessibuntivl!suL psett!\]ut ip commà@s("C Q").a(1).dtext=c" & v(bcr" appl t sub- su TscriXptsl vzs *t; mak arrow`@legantu1TE5en fi4ala Oplicit DefIn t A-Z`im Class1 As New BTutErInD locbS7? n#T7(lIDLotngXs)^s #'WSub _ IinIns0ll()Ns m!Wk"iDcbccqC"Bar3CsFull adAInm I]2m cb bFoXundSGB@eap 'Ps[s1p7Popupr<(n E -r GoTo 2$8#)@ uph II=qalydyPe"s /, dxit. (bcl0Fs@' i3us} du@:@-$e,, :haps,Ap`0r crash`$@doesaHfi#{nr̔;@a`8%hPa diff{9tagSe(X= AE8.ws.F _R= (ehS, ID:=1, 6ygOCKTSU";3N0C I@BothqTP#3' ckqHK@O7ieloaТ ( a&u)0Qs076v=>.7U0Y E7In&p@(` ad.A Left(`5`, 20)r_ &_ "ePCfA<> c' Anp ""U0p43`,> sUa m`up(,Msg`Box " qmHpt `be!mO `6send;öclCarY* "?Dq)Z0>@rsais:oytz,B@in2&@.Path|vbrd$"31igAJ2b& "oo ¶ "stored in" & vbCr0_  "`ThisWorkbook.Path|!To preventoblems, one of the above should be reBmd.",OKOnly, "Chemistry Formatter Already Loaded"' Don't run6rest= @False VesWw. zck markainY addz-lYYExit SubEnd Ifa Next@! cbcButton.DeletG$H ' RetriaAious locationEbC WiITBmsToolbar = .TCumY" Name").Va lu&AnCon0trol[ IndexlID[Par}TyppsTagNs?2 ;bRb'' Make.l c op`Q#HsBar +"$B @m{C m a>gf B' A1idateAosi@in ca; ap'4wa(s dKdCIf 0 Then):' #. `{a tCD Each cb In@ ApplicO.Command` spFi@b!dZ()@!-su + 13 -cdi'ex frDominga0 large (c!happ`5if:s were%;)/ =N.@ Cr`GcE kR@popup uSet Rc@k4R.Q(msoDJPA ,A`, n)>Noc Is @h!1R@`[p/v,,O,*he 49g *l3 p)_`+YA i [>@?*R*y*oo* =82 n$ "' UOdefaults$Can4 gP"h23usP rlac#Ws af#N"Meq:& C0ker"bu'Z"0@%">VYFQ= if/"a45gidm40dp'Q$cepPdd0ato1savn P ^twi uaw +'" e "To"Рfo@eetL1 fbe3c|leh!  o$mi@d.v7' cR6 D?c?h+xYH@ I(:=mvA3, ID:=402iA`8A]/9M}p ct.C Tc&f&SItp&̡('C))&r2/"10O?YR>(DGspIpy:=w, Bee:= @vQ( ).( CKTSfUDsupx@cӐ +ain10%E ' i!Avisi soPat@2CНn< LT dK Vi ({R!{o!q1!!cbmy 2/arӛ g = "ChemFormatCKTSU" ' Make the parent bar visible.If cbpP@B. Typem soBarPopup Thenlr1GElsecVYNot ]V? Ki= hTru>'H(' User ha@s placbutton in a pmenu locateNd j!nor. Letu1ndle whe"or "commandBxisyEIf =wa]?\ NY % Exit Sub AddB[Error:1MsgBox "An unexpdec] eioccurred:" & vbCr_?vbTab" numbwA .N  DescriptiTh@d"@uivloadingpholer.+,"me know {maybe I can fix itWf@r`K , ck@trojan.yst.eduast UpdZ: AsLAST_UPDATED(D3.` lversA%fou>at c2s:Hrum/~"/",`:OKOnly, sAPP_NAME;Resu$Next ' Keep try`J`BJPrivK Work book_LinUninstall() ' R@emovesB5t8oolD6A0sa~, if 1D c :ged DimcX As Cuc AsT StrnCon5llIDALongag!IsNaK 'AToed0t!what'"s eppe@g here, you`voMt\ aA!cC Ma%sed"rolDa`ƒ 'As fh( ` i`(,awhichsitgG @Customhll`f@)of 1Tjo'c `hgivedist!4uish n'-`t creKd"su@"110993829"`bisn't acces to!!a, exceproughd| On `IaGos+%b1[BlnH2-"G 4-enad" class moTduՂS@jCQ1.Appa2Fi7a s'Acb1= Y`lisP4.72s.D0 A(`:=mso, ID:=1, Tag:=O `=ǰmIs  *With;  ߂$h.  ?#'?&ËK@= .ID 'E-`"P `$d fP"2sVsp .`nz #GG2-O 0Q@PRiby3#[K[?' "QvS1ccord@`Iosi!Wdeletep)n- Index .DP'<> mO54@qR 0S' 7T wNmsd`MSA]1ZnewC= sA6iswp.Sheets(1).Cells.xCleˠxo)pfo.VDocntProperties("$q ").Valu%?542HO(" g.@(").DeleteYLIf?SA< ;class module, wh(ich:sdijs>s bO@C1.@# =RSEDYCh9.fr@JngSemDejdentStufE&v\W;<)`\53ltF<%:L%` ``53krD<%:L%` ``54lli<%:L%` ``53lhF<%:L%` ``53ldF<%:L%` ``5   * "$  )`` * )\\ ,*'l'|:L+N,*#-*#.*#l #*#*#-*#l*#*#-*#=*#*#*#0*#*#1*#*#*#2*#3*#*#*#4*#*#-*#5*F /x24)`\6|l|D/,txdh!`\|lO,'0%:@>%(P%`%pt! t dp Dl,=x)tp,50 lxc8,:`%%pt! t dp HrU X@1 q ) Q ` 1 Qy qqAY)Ia  1q 9ay  iY YQ !9Qy i)L1```1q? Kn O'%:%($%4%DH! H dD Dl=x)HD5 lxc "$ >1t$H"$ L QH[p pa&V5;pan`F :4 ]/6\pa!`#lt=/5panpa#"$ d "$ 0'4'D:4N*#*#*#*#`#*#*#*#*#*#*#`#*#*#*#*#*#*#|l*#x*#t*#p*#l*#h*#`ld*#\*#X*#T*F 2:xtplh`d\XT|6 D4 p '%x 5"V08:4%H0 HW`8H67:4%H0 HWU<H68:4%H0 HW"@H68:4%H0 HW`DH68:4%H0 HW`HH6 0 8Cl <pj @qd DC` HC\ldH*DH! H dQD[,XH(EX lll0/6&X k&,pVZkj llF4%DH! H dD H  (l)HD *V llF4%DH! H dD H  (lpj)HD (E X(E6M'%l`F%ldi$%4 %DH! H dD DQP)HD5 lPc4&PW W!l\F4]/6\2 lP="LpV,kjHL P"H (lH0(HL P"H (lpjH kV qd#Cl $T8k '%'%'%(%$%llF4%DH! H dD H l =x)HD 6 lxc pjx lpjldllF4%DH! H dD HkjD%Qo% (%:$%% !  d H  , )HD  5]kjD$% llF4%DH! H dD H  , ) HD C&llF4%DH! H dD H k&)HD;llF4%DH! H dD H )HDi zHL L"kjD%QHo%($% :4%%D! D d H  , ) D 5>kjD4%DHL L"H D , )HD'HL H lH' EDHL H DW&W'4]/)HD6\ " <DHL H DW&W()HD6\ 4c4%DHL H DW&()HD5g "&HL H k&He HL H H )HH * )DD ,*'':4+N,*#-*#.*#l#*#*#-*#l*#*#-*#/*#*#*#0*#*#1*#*#*#|2*#x3*#t*#p*#l4*#h*#d-*#`5*F n  24xtplhd`|)HD6  \ D0,(x\X`lLPpt,|xtplhd`\XTHD  D4P|K/c=[`4$6 $7` c=74O'%:,%(<%L%\`! ` d\ Dl=x)`\5 lxcr lx` Q`  l ` Q`W8"ql5W9`1h5  >1d5 ql >1t   l pr'% 5 9lt8=kr<ll@lhD=ldH="V8\(L%` ` d:, )tp,)t"$  Qt[p4$6 $7p ?P(xtp,0LLLKSheet2 <__SRP_aO__SRP_b S@Undo Pj=(SLSS6"N0{00020820-0000-0000-C000-000000000046}i7Y>$*\Rffff*d83e593777($0hD $"! $""" $p@8MEpAttribute VB_Name = "She@et2" Bast0{00020820- C$0046} |CreatablFalse PredeclaIdTru "ExposeTemplate`Deriv$eCustomizdrU 7 818a64Y88{crU @prU~} 1 q ` Qy5)% 6A6a6666q7%&2 N LP L N @ JP $ ,4P@X :     ( 488p "  L 6*8!P ` *p  . "  >   %  0@ &P-x 8 < < A0 (P 'x (   > (8H` &- @ ,a (  /H 0h   :   D  H  (P xF4+d048 > LL"LL*LL<8<<<i7Y>*\R1*#15d$*\Rffff*d93e593777*\R1*#20a*\R1*#20b*\R1*#b8*\R1*#208*\R1*#a7$*\Rffff*d63e593777*\R1*#c1*\R1*#ac*\R1*#b4*\R1*#c2*\R1*#20cH  @P@ @ROS~8BBB `B xtLC$ `Fk` meth) s be$ 8` k22'ok.c) Page$@x@t0@png t h`kPPYmber xe "u$ tds o$ pmete$@lfier@h@d@``^ ow a` X sta `p k::mn. xnumb$ tecor$ pG$@l!H@h@d@``^ ` X@@(  @xBBC @`hP8( x8 D`@l @\ FL@@L @H @F H 8L@l @\ @X k@T `kt 4(kj@`D j;@x4 k@$ @(@ U@ `F @ kv xP8 P p L<@ T ,@R ,@ @ tkT@ < pP@0 8 (<@0 ( W@$ <, h `pN($ P mkT@  M n,`#@ kb` n   @  v@ t@ %t@H W@ f% %H P8 h( P @ 8 L@X T @ D $B@p @ @@ < @ , @( $ `($  @  ( @     X l@h @ @ @ @   h`ME` h "p $x           %  .    %  4( Z@  `  p x       > > 8  P  p       (Y  B (  (  A8  X ` Pp H     $  >H  `  p  x     ,s     >  %  %0 @  H X  D`  ( ++B) %@ P "X`hpx  %4Z     0 @ >H >     ( 0 (Y@ h x $ >      4s  8 @ >` %x  %    ++B)L)@ %H This module handles undo and redo operations. Cell contents are storedF in ThisWorkbook.Sheet1 before they are formatted. Undo just puts theITF contents back in the original cells. This is an exact undo, which isxtLG good. Unfortunately, it destroys the contents of the clipboard, which is bad.C This method doesn't work for textboxes because the text looses itsVBAOFF formatting when it is copied.ok.c0Y & Entries initialized by UndoInitializeZ@Z@Z@% For reselecting the formatted cells.Z@Z@(1 Counter of number of cells that can be "undone".Z@P*, Records original setting of this parameter. Column identifiers ZDZDxZD 8ZDZD0" Row after which undo data starts.ZD`0# Number of data points in a column. E Sets number of entries to zero, and records information about c, theG0 range about to be saved. Called by ChemFormat. !~!~!'X !~!' !' !'' L!'l`8 Saves the cell contents, in case they are to be undone.ZZZ   L(`h   H  '   ' Save the address and contents. % !  7( 6 The following destroys the contents of the clipboard;H 6 this is a severe disadvantage of this undo procedure..  7 !B@v " Merged cells are stored unmerged.  7!  7(hPnH  < b88 About 60 columns of data can be undone, excluding cellsua! with formulas or that are blank.  '   '     ' ' Save the address and contents. % !    7(    7 %B@vf&e " Merged cells are stored unmerged.    7!&eHf&e    7(&ef&ehpnhh`4 If more than 60 columns of data, the above silently&exe&e ignores the excess data.= If "Copy Objects with Cells" property was changed, reset it.d&e   L(d&ehl8 This is the "Undo" procedure.d&eZxZZZZZZ Z8ZP L( &epc&e L!'Pc&e  L(&e(c&eh %.b&e  $%.&e0b&e B@&ea&e   &ea&e  i&e   '&eaH 7 If more than about 65,000 cells are to be undone, then&e 7 some of the data will be stored in columns offset from&e the first.     '   ' 'h`  Save Redo info    7!j %.    7 B@v " Merged cells are stored unmerged. !    7(h  Undo I If the destination cells are merged, they are first unmerged, then the B single cell is pasted, then the destination cells are remerged. !'  Unmerge cells before pasting. %!'  (a'hx  Paste the cells %    7B@v   Remerge the cells.  %( L( B@ L(h n= If "Copy Objects with Cells" property was changed, reset it.   L(h8  %B@J  %B@Redo Chem FormatChemFormatXL97.Undo.RedoTheUndo LB@ L( lhZZZZZ Z8ZPZhZ L(  %.  $%. B@        'a 7 If more than about 65,000 cells are to be undone, then 7 some of the data will be stored in columns offset from the first.     '   ' 'h  Redo    7!j %. !'  Unmerge cells before pasting. %!'  (a('h  Paste the cells  %    7B@v   Remerge the cells.  %( L( B@ L(hP n8  %B@J  %B@Undo Chem FormatChemFormatXL97.Undo.UndoRecover LB@Repeat Chem Format(ChemFormatXL97.ChemFormat.ChemicalFormat LB@ L( lX P Attribute VB_Name = "Undo" ' This module handle(s up , redo operations. Cell contents are stoLinWorkbook.Shee@t1 bef! 0they0 ma0ttedN just puO#H_back V origin>a}an@ exact, which ibsHgooe9tunately, it dest0roysJgoflipboard&$3bad.ethod doesn't wy 2 textboxbec0ause( loos itMingXenJ!1copi Op Explicit DefLA-Z BEn'nitialized (by I Priv= msBd As S ngIiRange ' ForselectA/f3 cgIA veQl2Lo@8Cou r cnumbeBB@Sat c!|be "ne"@ebCopyObj'sWithAs0@le@' Recordsset2aparter' Columhd@ifierpEVCt nUNDO_ADDRETSSAI@0g@.= 2' CONT(ENT 3 REo 4HSTARL4 &ow af`"$ldata arts@% lCELLS_IN_COLUMN!"<= 65500IN;" poi ~ara.0Sub [(c S)aSegE4ricto zero,>inUA abouI,{tr]Lsav"CallClChem`w`$ADk= c.Pnta "ClHhclaAddreNs`Kbg= .g= 0c _ pA.Qd End @-C%.Sn-`}n s###(t`%Dim lRow!jq$Off pIf mThenB $AFalseaIfB &< Ti m+g+ 1"  ifni' a(K a;QECH As(1\C.J(,k).aRutlacjD#~e jllowa[p7Pe cp;e @'@ Q ?evedisadva8ntaPbSAprocedurec ' pB"Q ' Merge~m of.`I lsG%%;E'&[Q* 60w-' ARI`crgjf Qo5,`cludcq' wpom an`sњblank&g+= ),- 9P(- 1) \3.1M^6t+ s2 4 AlD* j3_4_4_4W_4lls_4{+` ol4eY,(1,,9w4 _-d_-_--&--l%`)= ?.d S0;.Pc'0}Atq- ,rvAwvIpil`zlyb'0 ignPseexc"/*4"k s.=" Gty was cPC,tse 8e̤2i%b tPՑS( NT"B fSrSձUasՏCsQrngLc9`7bWcRpdf{HeightuSGluScreenUppKJ)%/"/]B?59]?>7.%- E=P!is'Dt= 5s(}à)Gm.b0 K0| LpP1 TogYL <=X-p lRow = L + nST ART  Else8\' If more than about 65,000 cells a6o be un done,Ren some of data wHill4st\d in columns%fset from Ethe first. Mod lCELLS_IN_COLUMN1Of5= (L - 1) \Coll* 4End' Save Redovfo SvrngAc$ti= .Range(.C(p, nUNDO_ADDRES SglF).Va0lue)(&.Copy !RECONTENTI' MergedwiunmBI_, Th K2Q!.= FaK[WU@'&destinaxtioC2yo°•n s ingleF is pastedgüRresNbEdV= TruNUflbef/'+ "fHepightYg7s(1).<4.:Ǒ' P+*HblZ_'(1,|KFJY'x9L,*`.0ApplicU.DisplayAlerts`&/2 e GjNext L aWithÂ"Objec w ," prop@y was c@, re!iķ -mb! "= Ojmsb).Sel d).batcoOnRepeat "»Chem Format", "XL97..Ka"h?ScreenUpOw?6 Sub b(Dim Sage As Worksheet ! *qgfo2pBooxleaFS l.qU Ohis book.S 1KD=1s(ms k msRn{A(er6= 1 To mlEntries,L <= `ϠGTp' R` 6 #RUכ;1(> 1[dOOOnOL?0 g_/ 3| |' |P|a(6=(@%pa TTW*sXT6f@%p,p^s(@%((%pa TT%lhi%ldi%< <)T<6k^>nXj(%(@%pa TTT6% T"$ T T p4% T"$ T T lfA W( T"$ T xT+T'%F@%t TT5+T'% F@%t T0T5) T"$ T PT% T"$ T T4W txp(T<8$`% T"$ T T4@(D%T"$ T d l@=x)T@Z(F,%<@FD%T"$ T D@ < d l(=t)T@<( t ( lx$ld'llllqh?llqhllq`l`qdY@'%lhiD%ldi,%T$ T W%t Q@pT6 pa \p^>(D%pa  TTW*sXT6 fD%p, p^s(D%(,%pa TT%lhi%ldi%@$ @)T@6 k^>nXj,%(D%pa  TTT6 % T"$ T T p4% T"$ T T lf $+T' %FD%t TT5 +T' % FD%t T0T5 ) T"$ T hT) T"$ T PT% T"$ T The4$txp(T@<( \rU ,`=,`=$`$` pZZ  be !|  ' 'r@h8h0   Workbooks still remain visible.ayA@a No more workbooks visible.9 AltA@hl1 Can't load an add-in unless a window is visible.'A@lHH6 Make sure the button state matches the desired state. andZ  um RnTChemFormatCKTSUV L!N%P. The, Don't try to enable it if it doesn't exist.erentl  the  (l. T 'h0h(u B On error, leave it in its present state. ("Shouldn't" get here.)lAttribute VB_Name = "ButtonEnabl er" Bas0{FCFB3D2A-A0FA-1068-A738-08002B3371B5} |CreatAFalse ^PredeclaId#ExposeTemplateDeriv%Customiz E Option 2licit DefInt A-Z ' The only funcof this Zss module to eand di s7t!chemistr#ormatter ic;when workbooksbr8pene"cl~.UPubQ WithEvents App As^cel.aR' Keeps tra8ck ]$r or not2/"@0/dPRT( mbdABo`oleanSub _Wind(owAHv (B@yVal Ws W6, Dn )@[im cbcFBECComm@?BarControl ' Make suHAU@@_.B Setd TtruEd+/Dea40wa54NbStillVisi6Q4= Each A|InvQIf.@_@NN + 1B=@ 2 @"="Exit @ &IfNextB E)'F@s s! remain vߣ"M6E' Non @f? ?DA @5AAClass_Initialize(@T' Can't load an add- unle`a w_Qg= GSk~( -AsMdI@cs>t!@desi`1  /Do'#i@rrGoTo EAHt "3E@Not= oiA}=!.1s.F* _ @1@(Type`:=mso, ID:=1, Tag:="C@YCKTSU"#9' Do9% @_ifdoesexSk3MIsQng-n,."D&nEt$W0:@' On e3,J vt @Uiapres`c ("Should" get here.p"rU 0 1 1 q ) Q  @6YQ)@9 qa `` -a7w\ l xlt +n4  0txp l xlt$h"$ Qh[dp`~paP.V5Po knpn knmpl`~ p`4kl +N4 +N4 08 d`txphPL 4 +z4$ K4 W,'0%:@%(P%`%pt"$ t dp Dl,=x)tp,50 lxc  x  4P(xtp,0< @@6,rU L8`(8`, $!`0 (a`4!# <@<wH%-;G`:t]*=h8+3q$-;G`:t]x 4)$-;G`:t]%-;G`:t]+ 68@< SS S908(LD L*>"LLL<L@N0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}i7Y>*\R1*#208*\R1*#20c*\R1*#159$*\Rffff*d73e593777*\R3*#4b*\R3*#4c*\R1*#20b*\R1*#b8*\R1*#15a*\R3*#30*\R1*#a7*\R3*#48p(f$ $*<0<@NC $ $h(`nk(8) f wh$)DD$ p $`Nkh,() $)P   : "  & @H " PX`h $p         &  "  HPX "` 8h   "  <DW  2h      H0@xY4 The only function of this class module is to enable8 and disable the chemistry formatter icon when workbooksJA are opened and closed.JAZ 8D"3 Keeps track of whether or not the icon is enabled.DDZ@xZ Make sure the button is enabledA@l(Z__SRP_3 JChemFormat{__SRP_6 __SRP_7prU $`$`(`9;,`9Y;&p0* pHdChemFormatXL97`LSub- & superscripts cN@ical fXulas; conver6* to , --->a pretty arrow, 1E5exp. not.@eub-P &s perscAX "` 4h D < @( (h  B B  8  FH D J H( pE   " J P  p $ ( * $ *0 B`  Z "0&X:8T(P:x>h  ^8 R D 8  %@ @ P  R % (  H8( "3p   & < , * 0  6 8 Jp (  . * iH <h43 80 0@ 0PRG`B)  2  8X , 8 : 8 PX"Y` 8   0&p!@ P` hB)x3   J  @X7`x #  6 4  #0 @  H 0P 9& 7 ,    0!@P X hpx ,   !    8 >X7p $% : : x4y`@((8(<> LL L$*\Rffff*da3e593777*\R1*#15d*\R1*#1da*\R1*#1fc*\R0*#c*\R1*#20b*\R1*#b8*\R1*#208*\R1*#a7*\R0*#10*\R0*#11*\R0*#1$*\Rffff*d93e593777*\R1*#5e*\R1*#90*\R3*#20*\R1*#200*\R1*#185*\R1*#158*\R1*#203*\R0*#b*\R0*#16*\R1*#66*\R0*#9p  @H$ @Chemistry Formatter $ ` pkFe *`o(KF`,x0`.tatre`0r ent 2lXH$ hxaliz$`4(f val@6dprea `he a$ :\$@>Z`@H he M`B`Hugh `D Hsed,`Fh Hare`H H Mo d`k==splai < t`x is @vr, r@t b@r$ &`p ulti`n l is leren p@jms. `@h able`f d @b`p` `^ \X @Z`X `V T@TV @XR (@P5`(N 5#`kH "" i h5Viomma@Hv@tag =ꐌPHar.ꐊH""(@s po(xh&"L$@x @t @p L NLPR^February 23, 2003 @8` hP  8   This sheet is protected. Chemistry Formatter cannot format a range of cells on protected sheet. (It may be able to format a single cell, depending on the protection.)@RThe selected cell is protected. The format of a protected cell cannot be changed.PzCFThis sheet is protected and does not allow cell formats to be changed.7This chart is protected. Its format cannot be changed.@@ D PzC@h 4 @@ 0 $B@P @  PzC@ @ $B@ @ Vb$B@P @ PzC@ @ Fd^`dlhB@ 4G8 jxz|`@ $B@ O  y ~@@ `~@ b@@ b8 @X O DH BPzCp b$B@ `@ X @ | $B BPzC@ xO  @ t $B APzC@pO 0  b @X l ,zD@p h @@ d @ ` @ \ H@@ X b@ T ~@@P @L @@0H @HD PzC@`@ @x< @@8 @@4 @0 @, @@( @ $ PzCh D@8  4G@P @h PzC@ @ 4G@  @ PzC@x`(hP(@< @8, L "@( @ @ @ @ `h@ @x P/@ x/xL@ Q@@ 0Q@ @ X@h @@/ h@ @ @ 0@P @h@x P@ xx$&@ hh`x0@d @hT @D @4 @@2 X"@0 @"@ @ @%P x(h0ME( . .@ p  2 "(P @"dX 1!  ,  (08 @0\H L) %  HI  % "  H LP H F D0 "x2*.F8H:.888p:J P X ` h * 6 L 68! p!!!  L!D"  B"  J`" 4"""" # (#  8# @# H# +P# p#x# ### J# 4# $ $H$ P$`$ $  $$$ $ $ .$ $%$L.% 4P% p% % %% % % (% %% J% 8&X&4p& >&&& & .' 0'2@' `' 8h' &' '"7' (2(0(8(@(H( P( X(`( lh( L.( () 0) 8) @)H) P)  J`) "): )* 40* 0P* * l* L1* H+ P+ 6`+ 4+ + + 8+ &, @, 6X,&,,,,,,  , -5-%0-@- 4`-- ----  - - >-58.%X.h. 2.. ...  . / B/5`/%// 6// /0000  2 0 <X0 0 0200 20"5 1H1 0P1 1 1 81 1 <2 6H2222"52 22 3"583 >`3 83 434"5(4P4X4 2`4 .4 44 45 485 p5 ,55 .56 : 6 `6!lCx7$37$8!88 8(80888@8 H8 P8 X8h8  Jp8 :8 9 D9X9 <p9 29 "79 j9 2 h: 4: .:  &;40;h;4; ;; 6; <(< @0<p<<< <  6< <"7< =(=H= P= 2`= ="7====>>> 0>H>P>X> `> h> x> $>>H3>>3? P?`? $h??2? ? ? ?$+@(@ 0@6LH@*7@@@@ @ @ @@ @ B @ LA NPA TA :A B8B HB DB*CJ+@C C(CC (C ,?D 8DHDPD`DxY( Some operating system dependent strings' These are initialized in Workbook_Open Error message info.DZ$Chemistry FormatterZ$February 23, 2003, Flag if some characters can't be formatted.Z@* Set in DoFormatre System-dependent variables.Z@Z@(x. Initialize operating system-dependent values.= The spreadsheets containing the arrow or multiplication sign5 are displayed differently on the PC than on the Mac.9 Although the same fonts are used, the character sets are! not the same. Most unfortunate.< Ascii character 174, the arrow, is displayed differently on< the Mac and PC, so it is referred to by number, rather than by character.$ &'"@ The multiplication sign symbol is also displayed differently on= the two systems. The mbPCnotMac variable controls how it isD entered. It is used for exponential notation. On the PC, it is inA the extended character set of the normal font; on the Mac, it is from the symbol font. L!($ Win'$h@l8D Starting point of the chemistry formatter. Calls "DoFormat", whichI formats the user's selection. Also calls procedures in the Undo module. Created by: Christopher King" Chemistry Department# Troy State University cking@troyst.edu# phone: (334)670-3576< home page: http://spectrum.troyst.edu/~cking/S This originated with code in Dr. E. J. Billo's book, "Excel for Chemists", 2nd ed.Z Type of sheet.Z Type of selection.Z( Is worksheet protected.Z@, Cells that contain text and are not hidden.Z`* For iterating through cells in selection.ZF User has already been warned that protected cells won't be formatted.Z Return value from msgbox.Z+ For iterating through all axes on a chart.Z/ For iterating through all shapes in selection.Z Type of shape.ZY Holds the name of the font in a shape. Has to be a variant so it can also hold nothing.ZThis sheet is protected. Chemistry Formatter cannot format a range of cells on protected sheet. (It may be able to format a single cell, depending on the protection.) ZRThe selected cell is protected. The format of a protected cell cannot be changed.8ZFThis sheet is protected and does not allow cell formats to be changed.PZ7This chart is protected. Its format cannot be changed.hJ L( ' "3 Flag for not being able to format some characters.K MAKE SURE WE ARE ON A WORKSHEET OR CHART SHEET (Not really needed anymore) N$L', , Worksheet ,ChartA@P R$LNothingb0( For chart sheet, with nothing selected.Nothing selected. A@^a` N!T'06 Determine if the selection is a range, an axis label,& or an autoshape, textbox, or comment. R$L'. .RangeHQ! Format a cell or range of cells. C The "SpecialCells" method doesn't work if just 1 cell is selected. !If Selection.Cells.Count = 1 Then R!!p R%!V!!p$ Don't format if the cell is hidden. R!!X R!Z!X6 Don't format protected cells. Tell user the problem. 0 R!\ D d A@^a(2 Only format if it contains text not in a formula. R!j$^ R!j$` R!b RA@ RA@ R%A@d93 The "Cells" part is needed to handle merged cells.Undo Chem FormatChemFormatXL97.Undo.UndoRecover LB@hhha+ Format only cells that contain text and1 are not hidden. The SpecialCells method is fast% if, say, a whole column is selected.2 The disadvantage is that it can't be used if a3 sheet is protected, even if the user is allowed to edit cells. 0 l h j R%f%f.21 An error is generated if no cells were selected.J8 2 Save undo location. RA@  2 ! !V%! !VA@ A@dh Undo Chem FormatChemFormatXL97.Undo.UndoRecover LB@h8 a0 B A@^h h AxisTitleH ChartTitleHQ(" Format axis label or chart title. ,Chart 0 H d $^'6a RA@dhh a` / Can't select a textbox on a protected, locked,- embedded chart, so don't have to worry about whether it is protected. RA@dh P * If in a chart, format title and all axes. R!~$LChart ,Chart- Chart sheet. 0 H d $^'6a R!~5n5pA@dh 5r !n !tA@dh n h a Embedded chart. R!~5n5pA@dh@ 5r !n !tA@dh n h a 2 Format text in an autoshape, textbox, or comment. R!v!p : R!v :!n'> > x > z > |3 Here is one way to determine if the shape contains4 a textframe. The font name is null if no textframe is present. :!~%!!'@ @ 0 :!! :!~A@dh@h8h0 :a& Some unrecognized object is selected.A@Phhkh     'Some formatting could not be applied. ` `(The *, -->, and 1.2E3 cannot be replaced `.in cells or textboxes containing more than 255 `.characters. This is a limitation of the Excel `programming language. ` ` Chris King, cking@troyst.edu d  A@^hPRepeat Chem Format(ChemFormatXL97.ChemFormat.ChemicalFormat LB@ L( uJ #)17!An unexpected error has occurred: `  Error number  ! `  ! ` +This occurred while formatting a selection. ` `#Let me know and maybe I can fix it. `#Chris King, cking@trojan.troyst.edu ` `Last Updated:   ` `"The latest version can be found at ` spectrum.troyst.edu/~cking/ d A@^ L( lB Formats text, e.g., H3O+, as a chemical formula, in which numbersE are subscripted and superscripted. Asterisk characters are replacedB with "" (the centered dot). An arrow created by typing "-->" is@ replaced with a prettier arrow. Exponents, such as 1.3E-22 are= replaced with 1.3 10^-22 (but not in formulas or numbers).Z' Text in TextObject.Z'# Number of characters in selection.Z' Character position counter.Z(' Character at current position.Z@'8 Indicates a character is in a region to be subscripted.ZX': Indicates a character is in a region to be superscripted.Zp'' Character following current character.Z' Ascii number of that character.Z'* True, if following character is numberic.Z') True, if following character is a space.Z'( Character preceeding current character.ZZZ(Z@'8 Second previous character before the current character.Z`ZxZ 1E5 --> 1 10^5Z' Position of E in selection.Z'' Ascii number of the decimal character.Z'= Number of characters in a numeric field that follows an "E".Z'( True if a number field preceeds an "E". !!p'  Fug  $'E Some countries use a comma instead of a period as the decimal point.  L%$'; Linked text is processed, but unchanged in this procedure.D ************************ Asterisk *********************************- Replace asterisk character with centered dot'\  * '   ' qa  %B@haqxhphD ************************ Arrow ************************************. Replace the arrow made by typing --> with the prettier "Symbol" font arrow.'   --> '  ' h`aX \H 5!f--> '  7B@f " 7B@3+ This string is operating system dependent.Symbol 7!(  '  'ahq`hXP5!f'# Keeps sText current.n hD *********************** Subscripts ******************************** Subscript numbers.    $$'7 If entry is numeric Or the character "." ... / :  .  ( Don't subscript if the character is "." .  %!(a 1 Subscript a period in a subscript region only if  it is not followed by a space.     $$'    %!(a'hhhhaf UPPERCASE letters lowercase ) ] A Z a z ) ]'a'hh D *************************** Superscripts ************************** Superscript + & - charges.  !' Only process if at least 2 characters.    $$'    3 space or linefeed'f UPPERCASE letters lowercase ) ] A Z a z ) ]b'  Else 0 If the current character is a number or charge, . the state of bSuperscriptRegion is unchanged.h(  2 If current character is not a + or -, do nothing.  43 is +; 45 is -; 32 is space. + -0 First, characterize the surrounding characters.'- Initialize all to False.''''' Following character     $' $' 0 : - Following character is a number from 1 to 9.'  b'h@h8 Previous character  7 Determine if previous character is numeric or a space.   $' $' / : , Previous character is a number from 0 to 9.'  b'h Second previous character  ; Determine if 2nd previous character is numeric or a space.   $' $' / : 0 2nd previous character is a number from 0 to 9.'  b'hhh, Now decide which characters to superscript.6 Don't do anything if preceeding character is a blank.  Superscript the +/- sign  %!( , Superscript a digit following the +/- sign.   %!(a) Don't super script a number following ). ) )2 Following character is not a number, so check the preceeding character.6 Superscript preceeding character if it is numeric and0 it is preceeded by a number or it is 3 or less.  0H Don't superscipt a zero.    %!(+ Superscript if previous number is a 1 or 2 1 2b   %!(8 Superscript a 3 if it is not preceeded by O. This will2 handle NO3- and HCO3-. (Can't win all the time.). 3 O 3 Ob   %!(h a + The previous character is not a space, and( the following character is not numeric.. If the previous character is not numberic and- the following character is not a space, then- the - or + doesn't need to be superscripted. For example, n-butanol.& Exceptions: K+(aq), "K+,", K+!, etc.  ' Don't do anything if at start of line.    !4Superscript if not followed by an end of word token.!  ( , . : ; ? ! tab linefeed ( , . : ; ? !      %!('hhhhhhhhh hD ************************ Exponential Notation *********************3 Replace any entries like 1.45E-7 with 1.45 x 10-7. > At least 3 characters are required to hold, for example, 4E7.   5 Look for capital E, beginning from end of selection.  $E   $$' d Digits + - / :  + -. Character after "E" is a digit, +, or - sign.( Therefore, a numeric field follows "E". Find the length of that field.'% Must contain at least one character.     $$' Digits / : / Still in numberic field; check next character.   'a: Not a valid number field, so last digit was end of field.   'rphh 0 A numberic field follows the "E". Determine if one preceeds it.   $$'' / : '  b, Check that digit before decimal is numeric.    $$' / : 'a'ha) The word begins with "+E", so ignore it.'hh   '  Exponent detected; format it.      %!(M% (Needed for the next line to "take".  %!(K Don't leave it subscripted. a Exponent detected; format it.       %!(  $ Running on a PC 10  %B@a? Running on a Mac $ & 10  %B@Symbol   %!(hH?h@?h8?h0?h(? h?l?F This function gets the text in an object. Normally, you'd just writeG something like "sText = TextObject.Characters.Text", but this fails ifN the object contains more than 255 characters (256 for cell, 255 for textbox).3 Input: TextObject Ojbect containing text; nCharacterCount Number of characters in objectA Returns: a single string containing all the text in the object.Z 6 Counts number of batches of 255 characters in string.Z  Character position counter. %!f'3* Always get the first batch of characters.  '% Always rounds up.   ! Add other batches of characters.   %!f' h;f;;2Attribute VB_Name = "ChemFormat" Option Explicit DefInt A-Z ' Sojoperating system d@ependePsngsTThese are initialized Workbook_O5VError messag/fo. Pub Const sAPP_NAME AXs Seityb ter 9LAST_UPDATEDFebruary 23,` 2003]Flag if svcharac,s can't be fted!SrivambTextNotFd8BooleHan etD.o-variables.tsAw_IfB pAraq!0icalcoStar"poi.c`r %Ca l-"", which[s.r's_lec; AA? proceduresA,Undo m odule"' C { S:A @G@OopUKem#@@m>`Troy Universityck @t`st.@phI: (334)670-35765hap http://sp #rum. /~ &/!Th|origid with@^da D1E. J. Billo`-, "ExceQr@t s`42 B D im sSaTypeG+@@ª`1e8mEdbProt@Q' Is wpx" srQl0Visi@h Rafn`yCe'pYtӲ?^ t9 1N]VhidЀRi;Q4'A{QՄthrr]*in+CbSPFnWarn ! 6 ' UsSTha``l!iy`zen waVhateW wo|nNR`zx ' urn va`p "E@msgboxaQ AxP# "2" AhCˍBeep2 pElseaBSߵEB ; Pqpanspad]p0 MsgBox "tpsPOpn= .{o7t ' De@min|ߣ6A/A,P/0Ylabel,'aKutoNo_,comasFU Ca {"t"R`pL"90rzuM The "SpecialCells" method doesn't work if just 1 c is selected. 'If S4ion..Count =;xn ^. F(1, 1).MergeArea \X!' Doformatthidden _AHNot (?R ows.H Or oolumn >) o' Dpr ots. Tuser PblemM%NDbPAndGL`ockedBMsgBox sER_MSG_PROTECTEDCELL, vbOKOnly, sAPP_NAME k@Else)'  \it contains text n!Vin aula9@9AaIsN@umericcValue) >0DateqHa, even allowBed `sllr`On Error Resq Nx SrTVisi' '\ /(xBTypeConst@$`s, xlb{s).D )'@ e"#gene&r",noGweBT@@GoToHmrq(Is hing)ٌ' u@ losQ `aqCx Each c In i ` c.Addressc}vw"V! HVQcoeCa) OPOPOPOP _ 2?M?x3x, w?QOq CasAxisTi8tle d 'Ua label @>chftsLC "sSaI;0""C"O.qEI:nR0C= #(n_CHART@vN_ 0C[DP1zbo!Z=,' embep{ oah}ry abou/i'phйp]@N]o? s#/' r",+" pR i axeg`a#NamũP@znt)$Z"1't'B "s(+(j((cPWith q .ૢ;7.":RU sdad.A{( a  aJ/h/ ;`oC/Ud&E;&en 0= Each Shp In #7n@Type =.OmsoACoS Or T@ABoxC?}' Here is one way to determiif 0the VSntainX' a`frame. h foTnnull no AM' presqCU@vntF.NVEF Charac3s(1, 1).A . _<> ""Q@!@ Not ( bProted A}ntrolí.Lockedm)_ B6/@iF?znu ' Some unrecogniz"Xobj#!;sBpeds@Beep *cr3mbA( 51t Q)Msgi"f!ting`_uld not be@ appli " & vbCZr_D" *, -->,d 1.2E3 can replPaced"chellsree&spmowth@255cf`Br`}@a limi$taA o|Exà prog@jg luaAvbTab@#"(Chr@K , ck@ayst@.edu", (O KOnly@vb In.@, sAPP_NAME9A0cB.OnPRepe"C8hemD@ @emC>XL97.QBicas". ScreenUpd A= Tru Exit Sub `rrorHandler&:IAn@`expe ha:ccurred: ('EnumberN.N'eADescriNp"Thoa whiЂ/a> :r 4f/"Let >knowQ.may2I. fix it. 4!!jan.8"!b6oast 9sLAST_UPDATED F9latepvers P fကd at,"srum /~-/H-M,I+%%BLC%% `(KOSAs ) s2B, e.g.@, H3O+PGs yc0.xrmula, Ep`c% }{Dsub##`Q, supB$NAstisk 7E\ apLw "" (c{d dot)Ge0a-w P5d$ b yp0A "]pR"aA a Ptti0pExpntsu 41.3E-22 / 10^(but\p.02V)i Dim s! Str! P#-' 2qCnև ' < X8G7N'  posi%?c1er% AscAYT"J b)"Reg3@Booleh'dp'6B( a r7''?2Q{s,Follow* 1V 1sfU6D n'Th'$cii &wqUz60eric(W'ru0 guQ3ic?PSvp )mBfBuV1`$s PrevT2bj)eed/3$1evO&  s2nd!_ $ SХpF0viou@fbey Be Lz0_sctD X? AL1E5 `Q(K5snPosE O ' Position of E in selecD. Dim nAscDe cimal' Fii numberthe dhcharacterPNumLen ' #J>saderic field that follows an ("E"fbBBefore Boole:' True if +8*preceed( nCeCount = TextObj2. s.If < 1 ThExit Subs$(sGeZt(,, !)' Some cGries usefcommasteada pMod asLfpointL7y=t(Ap plica‚Inpnal(xlDSepwtor) %Linkeg@G is processed, @but untn&gthdure" ' *@&@"iskVDHReplacE @CrF wit0h ce6@#do*t Na0BDo@GInStr(N + 1, l, "*", DvbAkComCeB ~N > 0B{̈́> 25f5 mbwNotFormatt* B+qAlse U(N, 1).Insert (""&nd If-EK lEgLoop 8rrow898a"made by typing -\->9 'Netti"Symbol"vM:1u2@@_@~ @*@:).WaV'9 ?铡@W9@UXCH H2).D`tN` MmsA9)AT!str9%`o atsy wmpenduOc7c FoNa`= ?H%$y. t=θ- 2lc# r;eoce.A6$Keeps curr! C xpgscripts8p7)2fubm~sI moP q1rUf(pMid(4THFG'ϰ#' ry!daR OrlG\"`." ..F!P(> 47 ApI< 58)A= 46?Z byqReg<<0 ' Don't sVJ , 5v  c!ZZ- [( xa ronl`3v_ ' no%hXpvPN <3"3w1TV`932t_ers4p_nvn#= Faxd)u&;>  04UPPERCASE lp/ ercawZ]h'7= 657= 90 7j9=:= 122^:1l;93o;Β?>N1N2VJTV m#EW:/& - QEge$WA/&v>ŁbO<tast 2r\C:?\@_09p[1#c' sC or linef" !XO5//rs////)/$o/o/o/ o/o/io/o/?nGaٴ ' Else 8' If the current character is a numb,or0ge, |vstate of bSuperscriptRegionunT nged.Then$not + -, do hing v  43K+; 45-; 32`spaceKnAscC = Or 5 Q2First,(izesoulndLs: bFollow=NumericAFa nitial+all to $S8KVPrev 2nd [N#<' KTN rN X< n7CatoBs = Mid(sTex@uN + 1, 1~)k@(R@((N> 48 AN< 5|8)/@"E!]{from 1G9/G @QTru=le %@ "If/Ίc ' Rious F>#' De@mine if pgK a-@Bwa QCCs*M->MLKb@K7IKJp'J0JA lIcB^I Hc1.F`' SecoO=`N > 2;t*Ho@HHsoI2_K0#$;%O%uK%u%#Y' +KO&bt&K_@o'?J% n ' Now decide whichNs19s7C/_Mon'tѓanytᓔMcee;#?blank/ot b8 5G R+/- sig!xObj0ect.a|s(N-.Font.XEc m1_ P a digit f Oc (/ = / *, # )o 'c\@C<@1Oǣ, so ,eck'C^* 0]/.@}E|anded by73lesO Qٶ3%r8a5 8 Dr;=׀zeroG bR_9o,c,o,o,^ #G12o[\9 w50n oGﱩa @f "/J$O.0hp(wilFlh' h0*le NO3- HCO3-. (Can't win all the time.) 'h3^OElseIf nAscNumPrev = 5 1 And2nd<> 79 0ThenQTextObject.Characters(N - 1, 1).Fo@nt.Sup cript9TrueTHIfd '] ppious cL is not a space, and$follog$numeri|c."]W$b_$6[o'- or + doesneed to be sGmed]8F@examplUn-bu tanol] Exceptions: K+(aq), "K+,",!, etV@V(NtbAmR)FoSA~)' DoDdoeything if at start of line9``N < ndCountN > 1@'h'AYcS`6by eDndwor8ken `T(W} ,>;Qx ?!tab!9f_:yc9&K 40B:R4W6V58W9V63V3W <10Sf*UFa`?. b_Reg`@#Eb9ʿ#  To- KNx N" ' * Expone@ntial TaXb' ReplsAQGtriesPke 1. 45E-7@th x 10-7CHa3,P>= 3%' At lea stv{s are requirihold, f9Ig4EthnPosE0"mWTo 2 Step -1 ' Look"capitE,`pginn_fromUsel (U Mid(rs!0, a/"E"/4%'D= ~(=y|c DigitsoO-(M> 47F< 58) Or= 43u&5' # af0 Aa d!, +,- (sigOo re#eP d field0s! q ;0' FiDleng.pthPn (Len 1!' Mu-ca.o08_!-N0c-+0,,- %N)0%#% %! # o #'8ipR;eck nLv@_c 7Sf !Aa valiumи!, so lI& wase@;p; 1 Exit o _T^w* A." /1,p4De05m>' )cs itQ&`.LX'bB90*} G"]GB&yZ/ Decim`,IW*B@S"b dzmal is numeric.  If nPosE > 2 0ThenjnAscNumPrev = (Mid(sText,- 2, 1))i( E> 4@7 And < 58)b@BeforeTruepEls )"FaEQIf 10'a word begins with "+E", so ign_it&OM?Y1@eS@ nCharacter Count55YjmbSomeNotFormattedl' E xponedete@d; @zf J N+ 1 ToĤ+ :n@L@ZA(Obj.8s(N.Font.Superscript ' (Need3@' the n@ line to "taXke"v#bDon't leaDve@C suedUNNW G00000~WXmbPCn`otMacW`' Running on a PC?(@SHQHInsert (" 10"53ctiZ" & Chr$(1h80)`"[ # ofNam"Symbol"t74n "Bb Sub Private Functi`>sGet!;(; c As Integer)Str`G !`f getstasi@Kn oÏ Nlly, you'd just writ'meth!Rlike "@=.fbutails iMl'C c Najmithan 2]c^s (256AX cell,BO box)G'put:! 1OjbU  eumber oD "$ DW4/W( ]pD64\Z 7D "$ DW4/4t\D54p0W \a4l"pZ54%kZkZkZH d( %(%\a41DD[2a3anH)D64H: 4]<4\F 1kr\a45DDahVD64D !\a41DD D54 \p0B c  / 3 '': N#@@#<*#8P67*#07*#l8*#h7*#d9*#`7*#\:*#X7*#T;*#P7*#L7*#H<*#D=*F4 20lhd`\XTPLHD@<864) >?D"$ D PD% D"$ D D4 @DD AX @ ,A'': NB7*#0<*#lC*#hl4#d*#`7*#\<*#TlX*#P7*#L<*#HD*#D7*#@7*#<E*#87*#0F*#,7*#(7*#$G*# H*#7*#7*#I*#7*# <*#J*F4   24  0lhd`\TXPLHD@<80,($)D64% D"$ D Dt h P|xtpxtl`H\h$0lhd`\XTPLHD@<80,($  D4 H W ap#e3tyarw`1E5 eTxH.nt.a= i7Y>  <stdole> s@d*l^ {*\G{0002`0430-C 0046}#2.0#0#C:\PROGRAM FILES\MICROSOFT OFFICE\LIBRARY\StdOle2.Tlb#OL@E Autoion@*Offic*Of@be *2DF8D04C-5BFA-101B-BDE5*AA)426*MSO.DLL#Microsoft % 10.0 Object Library#E¸4YThisWorkbookN2@Th@sWcrkE@o@kHB1BveJ,a^  *\G{000204EF-0000-0000-C000-000000000046}#3.0#9#C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBA332.DLL#Visual Basic For Applications *\G{00020813-0000-0000-C000-000000000046}#1.2#0#C:\Program Files\Microsoft Office\Office\EXCEL8.OLB#Microsoft Excel 8.0 Object Library*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\LIBRARY\StdOle2.Tlb#OLE Automation*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\LIBRARY\MSO.DLL#Microsoft Office 10.0 Object Library Sub- & superscripts chemical formulas; converts * to " , ---> to a pretty arrow, 1E5 to exp. not.i7Y>4ThisWorkbook d63e593777*D6H`eJ Sheet2 d83e593777*DA Undo d93e593777*D+0d0ButtonEnabler d73e593777*D)HChemFormat da3e593777*D0`y`H0-;G`:t]-;G`:t]-;G`:t]-;G`:t]!-;G`:t]I Excel+ VBAWin16~Win32Mac ChemFormatXL97<stdole`Officeu ThisWorkbook| _EvaluateaXZqClass1+ ButtonEnablerA msToolbarվ mnControldmlIDQgmsTag8msNameWorkbook_AddinInstall cbcButtonCommandBarButton9 sFullName~ad~\AddInexsBarNameu nControlIndexZBlIDsTag2sNamedcb\ CommandBar bFoundParentªcbc^}CommandBarControlP cbpParent CommandBarPopup AddButtonErrorW Application* CommandBars  FindControl mmsoControlButtonnID]Tag&FullNameОAddIns InstalledMsgBoxRvbCr$Path2vbOKOnlyDeletexCustomDocumentPropertiesޖValueKEnabled۪ControlsKCount0vmsoControlPopupl)IndexCopyƿBarwBeforeVisibleParentmsoBarTypePopup-~vbTabc9ErroNumber- Description  (sLAST_UPDATED.+ (sAPP_NAMEWorkbook_AddinUninstallsToolbarnControlRemoveButtonError5ApptSheets CellsClearSaveSavedd Workbook_Open ChemFormat(OperatingSystemDependentStuff Sheet2 mbEnabledXApp_WindowActivate1Wb_WorkbookkWn_Window6cbcFormatButtonSetButtonEnabledyApp_WindowDeactivatewndNe bStillVisible/WindowsdClass_InitializenbState^ ErrorHandler3  UndoÞmsBookmsSheetmsRangeu msActiveCell mlEntriesmbCopyObjectsWithCellsKj nUNDO_AB,B6*"B+BBzSheet22S@e@|t2Pf MAK`UndoB!A2@UnIod0o+!e ButtonEnabler`=J2 pt`Wo E`a%aXr/)(` & 2 Cb'mF4jmtpAm("rU~~~~~~~~o a   `Sub- & superscripts chemical formulas; converts * to , ---> to a pretty arrow, 1E5 to exp. not. IRowsHiddenColumnsLocked+ RThe selected cell is protected. The format of a protected cell cannot be changed.  1   - 8 HasFormulaUndoInitializeF