I have some back-end code that produces a MsgBox depending on the content of a front-end user editable sheet ("iButtons"). The below code works fine and pretty quickly but I am conscious of the fact that as the "iButtons" sheet grows I will need to unnecessarily manage this code over time.
Could I easily write this into a loop that quickly scans the iButtons sheet for all rows on the sheet that has content (up until an empty row has been reached)? Would the loop be fast enough to be run passively in the background or would the response of the MsgBox pop-up be excessively slow given the amount of code that will need to be run?
Public Sub iButtons(ByVal Target As Range)
'Pulls content from the iButtons sheet
If (ActiveSheet.Name = Worksheets("iButtons").Range("A4")) And Not Intersect(Target, Target.Parent.Range(Worksheets("iButtons").Range("B4"))) Is Nothing Then
MsgBox Worksheets("iButtons").Range("D4"), vbInformation, Worksheets("iButtons").Range("C4")
ActiveSheet.Range("A1").Select
End If
If (ActiveSheet.Name = Worksheets("iButtons").Range("A5")) And Not Intersect(Target, Target.Parent.Range(Worksheets("iButtons").Range("B5"))) Is Nothing Then
MsgBox Worksheets("iButtons").Range("D5"), vbInformation, Worksheets("iButtons").Range("C5")
ActiveSheet.Range("A1").Select
End If
If (ActiveSheet.Name = Worksheets("iButtons").Range("A6")) And Not Intersect(Target, Target.Parent.Range(Worksheets("iButtons").Range("B6"))) Is Nothing Then
MsgBox Worksheets("iButtons").Range("D6"), vbInformation, Worksheets("iButtons").Range("C6")
ActiveSheet.Range("A1").Select
End If
End Sub
Thanks!