ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell description/comment/tool tip? (https://www.excelbanter.com/excel-programming/350792-cell-description-comment-tool-tip.html)

Ian Cowley

Cell description/comment/tool tip?
 
Is it possible to set Excel to provide a tooltip or cell description or
comment for individual cells?

here's what we have:
A third-party file format is double-quote-delimited comma-separated
variables, such as:
"RX","1","Joe","Bloggs","23012006","123456","","", "34567"
"FIELD","1","6","Fixed","Sym","10","5","34567"
and so on.
So each line has a different number of elements.
We can import the file into Excel easy enough, and I've written a macro to
re-export the file with the quotes and commas and stuff.
But each element in each line means a different thing. For example, the
third element of a line that starts with "RX" is the first name of a person,
and the fourth element the surname. But the third element of a line that
starts with "FIELD" is the energy in use and the 4th element is the modality
used.

So what I want is to be able to import the file into Excel (easy enough with
Data Import), but have a macro or an add-in running so that when a user
clicks on a cell or hovers over it, a tooltip or description or comment or
something pops up telling the user what the cell means. So hovering over
the third cell of a line where the first cell is RX would put "First Name"
into such a pop-up thing.

Is this even remotely possible? In Powepoint there's the notes fields for
slides, is there a similar sort of mechanism for Excel?

Many thanks in advance,

--
Ian Cowley
Bishop's Stortford

www.iancowley.co.uk/contact



bpeltzer

Cell description/comment/tool tip?
 
Check the 'Input Message' tab under Data Validation.

"Ian Cowley" wrote:

Is it possible to set Excel to provide a tooltip or cell description or
comment for individual cells?

here's what we have:
A third-party file format is double-quote-delimited comma-separated
variables, such as:
"RX","1","Joe","Bloggs","23012006","123456","","", "34567"
"FIELD","1","6","Fixed","Sym","10","5","34567"
and so on.
So each line has a different number of elements.
We can import the file into Excel easy enough, and I've written a macro to
re-export the file with the quotes and commas and stuff.
But each element in each line means a different thing. For example, the
third element of a line that starts with "RX" is the first name of a person,
and the fourth element the surname. But the third element of a line that
starts with "FIELD" is the energy in use and the 4th element is the modality
used.

So what I want is to be able to import the file into Excel (easy enough with
Data Import), but have a macro or an add-in running so that when a user
clicks on a cell or hovers over it, a tooltip or description or comment or
something pops up telling the user what the cell means. So hovering over
the third cell of a line where the first cell is RX would put "First Name"
into such a pop-up thing.

Is this even remotely possible? In Powepoint there's the notes fields for
slides, is there a similar sort of mechanism for Excel?

Many thanks in advance,

--
Ian Cowley
Bishop's Stortford

www.iancowley.co.uk/contact




Kevin B

Cell description/comment/tool tip?
 
You could write a macro that checks for the different types of values that
you're categorizing by and insert the appropriate comment. The comment, when
inserted, is indicated by a red marker in the upper-right hand corner of the
cell. When the mouse pointer hovers over the marker the comment text is
displayed.
--
Kevin Backmann


"Ian Cowley" wrote:

Is it possible to set Excel to provide a tooltip or cell description or
comment for individual cells?

here's what we have:
A third-party file format is double-quote-delimited comma-separated
variables, such as:
"RX","1","Joe","Bloggs","23012006","123456","","", "34567"
"FIELD","1","6","Fixed","Sym","10","5","34567"
and so on.
So each line has a different number of elements.
We can import the file into Excel easy enough, and I've written a macro to
re-export the file with the quotes and commas and stuff.
But each element in each line means a different thing. For example, the
third element of a line that starts with "RX" is the first name of a person,
and the fourth element the surname. But the third element of a line that
starts with "FIELD" is the energy in use and the 4th element is the modality
used.

So what I want is to be able to import the file into Excel (easy enough with
Data Import), but have a macro or an add-in running so that when a user
clicks on a cell or hovers over it, a tooltip or description or comment or
something pops up telling the user what the cell means. So hovering over
the third cell of a line where the first cell is RX would put "First Name"
into such a pop-up thing.

Is this even remotely possible? In Powepoint there's the notes fields for
slides, is there a similar sort of mechanism for Excel?

Many thanks in advance,

--
Ian Cowley
Bishop's Stortford

www.iancowley.co.uk/contact




Kevin B

Cell description/comment/tool tip?
 
Using the sample row data an placing it in Column A row 1 of Sheet 1

the following code will place comments where necessary after evaluating the
first cells text. I've test this and it works okay.

Sub FlagCells()

Dim wb As Workbook
Dim ws As Worksheet
Dim lRow As Long
Dim lCol As Integer
Dim strRng1 As String
Dim strRng2 As String
Dim strVal As String
Dim strRX As String
Dim strField As String

Set wb = ActiveWorkbook
Set ws = wb.Worksheets("Sheet1")
strRX = "RX"
strField = "FIELD"

Range("A1").Select
strVal = ActiveCell.Value

Application.ScreenUpdating = False

Do While strVal < ""
'Get current row number, and set status bar display
lRow = ActiveCell.Row
Application.StatusBar = "Evaluating row " & Format$( _
CStr(lRow), "#,##0") & ", please wait..."
'Convert R1C1 cell value to A1 notation
strRng1 = Application.ConvertFormula("R" & lRow & "C3", _
xlR1C1, xlA1, xlRelative)
strRng2 = Application.ConvertFormula("R" & lRow & "C4", _
xlR1C1, xlA1, xlRelative)
'Evaluate the first cells value and comment accordingly
If strVal = strRX Then
With Worksheets(1).Range(strRng1).AddComment
.Visible = False
.text "First Name"
End With
With Worksheets(1).Range(strRng2).AddComment
.Visible = False
.text "Last Name"
End With

ElseIf strVal = strField Then
With Worksheets(1).Range(strRng1).AddComment
.Visible = False
.text "Energy Used"
End With
With Worksheets(1).Range(strRng2).AddComment
.Visible = False
.text "Modality"
End With
End If
'Select the next cell, get the next value & loop
ActiveCell.Offset(1).Select
strVal = ActiveCell.Value
Loop

'Reset environment and release object vars
With Application
.StatusBar = False
.ScreenUpdating = True
End With
Set wb = Nothing
Set ws = Nothing

End Sub

--
Kevin Backmann


"Ian Cowley" wrote:

Is it possible to set Excel to provide a tooltip or cell description or
comment for individual cells?

here's what we have:
A third-party file format is double-quote-delimited comma-separated
variables, such as:
"RX","1","Joe","Bloggs","23012006","123456","","", "34567"
"FIELD","1","6","Fixed","Sym","10","5","34567"
and so on.
So each line has a different number of elements.
We can import the file into Excel easy enough, and I've written a macro to
re-export the file with the quotes and commas and stuff.
But each element in each line means a different thing. For example, the
third element of a line that starts with "RX" is the first name of a person,
and the fourth element the surname. But the third element of a line that
starts with "FIELD" is the energy in use and the 4th element is the modality
used.

So what I want is to be able to import the file into Excel (easy enough with
Data Import), but have a macro or an add-in running so that when a user
clicks on a cell or hovers over it, a tooltip or description or comment or
something pops up telling the user what the cell means. So hovering over
the third cell of a line where the first cell is RX would put "First Name"
into such a pop-up thing.

Is this even remotely possible? In Powepoint there's the notes fields for
slides, is there a similar sort of mechanism for Excel?

Many thanks in advance,

--
Ian Cowley
Bishop's Stortford

www.iancowley.co.uk/contact




Ian Cowley

Cell description/comment/tool tip?
 
In message , Kevin B
burbled:
Using the sample row data an placing it in Column A row 1 of Sheet 1


Thanks for the pointer, I've now implmented the following code:

Private Function SetComments()
'Set range to top-left cell and get value
r = 1
Set wb = ActiveWorkbook
Set ws = wb.ActiveSheet

strval = ws.Cells(1, 1).Value

Application.ScreenUpdating = False
Application.StatusBar = "Adding Comments now.."

'loop over all the rows
Do While strval < Chr$(26) And strval < ""
Select Case strval
Case Is = "PLAN_DEF"
cols = 28
For c = 1 To cols
Cells(r, c).ClearComments
Cells(r, c).AddComment PLAN(c) & ": " & Cells(r, c).Value
Next c
Case Is = "RX_DEF"
cols = 13
For c = 1 To cols
Cells(r, c).ClearComments
Cells(r, c).AddComment RX(c) & ": " & Cells(r, c).Value
Next c
Case Is = "FIELD_DEF"
cols = 49
For c = 1 To cols
Cells(r, c).ClearComments
Cells(r, c).AddComment FIELD(c) & ": " & Cells(r, c).Value
Next c

Case Else
MsgBox "Unknown RTP line definition!!!" & " Failed on: " &
strval
End Select

r = r + 1
strval = Cells(r, 1).Value
Loop

Application.ScreenUpdating = True
Application.StatusBar = False

End Function
--
Ian Cowley
Bishop's Stortford/Cambridge, UK

www.iancowley.co.uk/contact




All times are GMT +1. The time now is 04:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com