A friend gave me pseudocode to help me with a project and I need help figuring out what i need to do to make this work.
Basically, I want the first row cell values to be read and a tooltip to appear based on the cell value. Because I pull a certain report often and the columns change constantly, I need to run a macro that will provide the tooltip.
‘Select the range of headers, either automatically or manually before triggering the macro headerRange=Range([first cell],[last cell)
‘or
headerRange=Selection
‘iterate through each cell of the range
For Each headerCell in headerRange
‘read the value
headerValue=headerCell.Value
‘choose the tooltip
Select Case headerValue
Case “AA”
Tooltip=”Tooltip for AA”
Case “AB”
Tooltip=”tooltip for AB”
‘…more cases
Case Else ‘default
Tooltip=””
End Select
‘write the tooltip
With headerCell.Validation
.Delete
.Add Type:=xlValidateCustom
.InputMessage=tooltip
End With
Next headerCell
Basically, I want the first row cell values to be read and a tooltip to appear based on the cell value. Because I pull a certain report often and the columns change constantly, I need to run a macro that will provide the tooltip.
‘Select the range of headers, either automatically or manually before triggering the macro headerRange=Range([first cell],[last cell)
‘or
headerRange=Selection
‘iterate through each cell of the range
For Each headerCell in headerRange
‘read the value
headerValue=headerCell.Value
‘choose the tooltip
Select Case headerValue
Case “AA”
Tooltip=”Tooltip for AA”
Case “AB”
Tooltip=”tooltip for AB”
‘…more cases
Case Else ‘default
Tooltip=””
End Select
‘write the tooltip
With headerCell.Validation
.Delete
.Add Type:=xlValidateCustom
.InputMessage=tooltip
End With
Next headerCell