SOLVED

Mouse hover in cell to display text LARGER code is very slow

Copper Contributor

The following code works fine on a small Range..

But when i expand the Range for the whole worksheet..it  runs very very  slow

 

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim x As Range
For Each x In Range("B4:BI84")
With x.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputMessage = Target.Value ''"First Name of Sales Rep"
.ShowError = True
End With
Next x

End Sub

3 Replies
best response confirmed by staspe2475 (Copper Contributor)
Solution

@staspe2475 Try if this fits your needs:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Range("B4:BI84").Validation
        .Delete
    End With
    With Target.Validation
        .Delete
        .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
             Operator:=xlBetween
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputMessage = Target.Value    ''"First Name of Sales Rep"
        .ShowError = True
    End With
End Sub

@JKPieterse Thank you ...seems great.!!

..What part of the code is making the text bigger ?

It does so by adding text to the Validation input message. You can try manually by selecting any cell, selecting Data, Validation from the menu and then typing some text into the boxes on the Input message tab.
1 best response

Accepted Solutions
best response confirmed by staspe2475 (Copper Contributor)
Solution

@staspe2475 Try if this fits your needs:

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With Range("B4:BI84").Validation
        .Delete
    End With
    With Target.Validation
        .Delete
        .Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, _
             Operator:=xlBetween
        .IgnoreBlank = True
        .InCellDropdown = True
        .InputMessage = Target.Value    ''"First Name of Sales Rep"
        .ShowError = True
    End With
End Sub

View solution in original post