I have a VBA script that displays a popup message when I click into cell.
Here's a screenshot:
I would like to make this a bit more user friendly and show it as Stock: 79,382
Is it possible to do something like that?
Here is my VBA:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rngStockData As Range
With Worksheets("Stock").Range("A2").CurrentRegion
Set rngStockData = .Offset(1).Resize(.Rows.Count - 1)
End With
If Target.CountLarge = 1 Then
If Target.Row > 4 And Target.Column > 1 Then
If Not Intersect(Target, Me.Range("A4").CurrentRegion) Is Nothing Then
With Target.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = "Stock: " & Application.VLookup(Me.Cells(Target.Row, "A"), rngStockData, Target.Column, False)
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End If
End If
End Sub