Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

VB: TEST A CELL IF IT HAS A SPECIFIC FORMULA hi, i am not sure if my posts are s

ID: 3570977 • Letter: V

Question

VB: TEST A CELL IF IT HAS A SPECIFIC FORMULA

hi, i am not sure if my posts are showing up..

i am trying to get help fixing the following, thanks.

If LEFT(Selectedcell,4).formula = "=MAX" Then

==========    ANSWER:

(this macro still needs some work, other cells clicked on causes screen jump),

how to activate a macro, when click on a cell, if cell has a specific formula in it:

Private Sub Worksheet_SelectionChange(ByVal Target As RANGE) 'single click

If RANGE("A1").Value > 0 Then   'easy safety macro's on/off

If Target.Cells.Count = 1 Then
    On Error Resume Next
    If Left(UCase(Selection.Formula), 4) = UCase("=MAX") Then    '<< ANSWER

   
      Application.ScreenUpdating = False      'UPDATE OFF screen jump
    
        Application.DoubleClick    'then do your vb
        ActiveWindow.ScrollRow = ActiveCell.Row - 1
      Application.EnableEvents = True     'EVENTS
    End If
End If

end if

end sub

Thanks for help !!

Explanation / Answer

Hi,,,

try

Is this what you're trying to do?

If Left(ActiveCell.Formula, 4) = "=MAX" Then