Hi all,
My code below allows me to enter active cell contents to D3 (which I use for search/lookup) but I believe there's a lot of repetition and takes 8 seconds to process. Is there a way to paste clicked cell value straight to cell D3?
Also, I want to amend the range from B37:B1000 to the last row with data (i.e. if last row with data is B100, I want the range to change to B37:B100).
Thank you in advance for your support.
My code below allows me to enter active cell contents to D3 (which I use for search/lookup) but I believe there's a lot of repetition and takes 8 seconds to process. Is there a way to paste clicked cell value straight to cell D3?
Also, I want to amend the range from B37:B1000 to the last row with data (i.e. if last row with data is B100, I want the range to change to B37:B100).
Thank you in advance for your support.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim iColumn As Integer, jRow As Integer, sAddr, MsgOut As String
Dim YesOrNoAnswerToMessageBox As String
Dim QuestionToMessageBox As String
If Not Application.Intersect(Target, Range("B37:B1000")) Is Nothing Then
sAddr = Target.Address(False, False)
Cells(35, 2) = "=row(" & sAddr & ")"
Cells(35, 3) = "=column(" & sAddr & ")"
jRow = Cells(35, 2)
iColumn = Cells(35, 3)
MsgOut = "Would you like to view " & Cells(jRow, iColumn) & "?"
'MsgBox (MsgOut)
YesOrNoAnswerToMessageBox = MsgBox(MsgOut, vbYesNo, "Talent FY19")
If YesOrNoAnswerToMessageBox = vbYes Then
Cells(35, 4) = Cells(jRow, iColumn)
'Application.Goto ("d3")
'Range("a1").Select
Range("d3").Value = Cells(35, 4).Value
Cells(3, 4).Select
'Application.Goto ActiveCell
Else
'MsgBox "Update declined!"
End If
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
ActiveCell.Select
End Sub
Last edited: