macro using tooltip

stratgery

New Member
Joined
Feb 18, 2022
Messages
6
Office Version
  1. 2019
Platform
  1. Windows
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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Macro for tooltip
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,214,529
Messages
6,120,070
Members
448,943
Latest member
sharmarick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top