0
votes

Hi I am trying to make a search page on an on-line excel (www.editgrid.com) using macro to lock all cells except for (B2 cell) and each time the page is opened it clears / resets (B2 cell) and I keep getting this error Missing ; before statement at line 1 Private Sub Worksheet_SelectionChange(ByVal Target As Range) how do I fix this error. Thank you

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Not Intersect(Selection, Range("A1:AS57")) Is Nothing Then
    Range("B2").Select
  End If
End Sub


Option Explicit

Private Sub Worksheet_Activate()

    [search_string] = "Type your search here."
    [search_string].Select

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
    Const CRITERIA_HEADER = "Description"
    Const TEMPORARY_NAME_CREATED_BY_ADVANCED_FILTER = "Extract"

    ' If change was from any cell other than our lookup, then exit
    If Intersect(Target, [search_string]) Is Nothing Then Exit Sub
    [search_string].Select
End Sub
1
Move the Option Explicit right at the top - Siddharth Rout
Hi @SiddharthRout. I tried it and got another error this time it gave Missing ; before statement at line 1 Option Explicit - Tmknzozo
I just realized that you are doing this online... I am not sure about that as i have never tried it. I am not even sure that vba macros can run on a webpage... - Siddharth Rout

1 Answers

0
votes

It would appear that macros for EditGrid should be written in JavaScript and not in VBA. See this guide for more details