I've managed to solve my problem here. It took me all night,
but I did it. Learned a few things.
One goofy thing I learned is, the tool tip won't display right if
the cell that was used to copy its contents from is not wide enough!
That took me a while to understand what was happening there.
I've gone with a temporary "scratch" range to copy the values into
that I want to turn into tool tips. It works well. I left some
of my earlier stuff in the code to do with the other sheets and
hyperlinks to them, because it is still useful to me.
Another thing I learned (not the first time, unfortunately) is not
to type "EntireRow.Delete" when I meant to type "EntireColumn.Delete";
and especially not before saving my current work first before running
the macro.
A third thing I learned -- is this a bug in Excel 2002? -- is
that running the code .Hyperlinks.Delete causes underlying cell
formatting to be lost. (!!)
Thanks to Dave Morrison for a small kick in the pants to get me
going on this. Now I can move on to the next thing I want to do.
(Spinner coding -- I have no idea yet, and my question over in
the programming group is so far unanswered.)
Here's the tool-tip code. It might be useful in parts to others.
------------------------
Sub tipMe()
'
' 8/5/2007 by Dallman Ross, with a nudge by Dave Morrison
'
' Keyboard Shortcut: Ctrl+Shift+T
Dim myRow, scratchCol, datRows As Long
Dim rgCopy, rgScratch As Range
Dim indie As Variant
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
ThisWorkbook.Worksheets("Stagger").Activate
datRows = Application.CountA(Columns("D"))
scratchCol = 19 'Column "S" -- must be empty!!
Set rgCopy = Range("D2", Cells(datRows + 1, "D"))
Set rgScratch = Range(Cells(2, scratchCol), _
Cells(datRows + 1, scratchCol))
rgCopy.Copy
With rgScratch
.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
.NumberFormat = "#,##0.00_);(#,##0.00)"
End With
For myRow = 2 To datRows + 1
' value in cell is also a sheet name
indie = Cells(myRow, "A").Value
With Cells(myRow, "D")
.Activate
.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:=indie & "!E2", _
ScreenTip:=Cells(myRow, scratchCol).Text
'ScreenTip:=Sheets(indie).Range("E2").Text 'alternate
End With
Next 'myRow
rgScratch.EntireColumn.Delete
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
-dman
==================================================
I had written earlier:
Okay, my followup question is, I'd prefer to have the screen tip
say the value of [the following] instead of what I have there above:
=MSNStockQuote($A2,"Close")
(but using the "myRow" instead of the 2 there). I can't
figure out how to do it.
The reason I prefer that is, the data on the other referenced
worksheets may or may not be updated to yesterday's close.
Also, on the weekend the MSNStockQuote function still gives
me Thursday's close, but my updated data on the sheets I'm
referencing give me Friday's. I want the *prior* close. (During
the week what I have will be fine, so long as my sheets are
updated through the previous day.)
Oh, and the reason I want a tool tip instead of just looking in
the cell is, the cell is formatted to 0.5 points' width and is
merely fill-colored to show a trend. I've simply stuck the data
there as a safe "storage" place, but now want the tool tip to
show the text from the formula that's there.