DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Detect A Field Edit In Excel And Refresh A Query

03.02.2007
| 7280 views |
  • submit to reddit
        
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim wks As Worksheet
    Set wks = ActiveSheet

    If Target.Row = 1 And Target.Column = 1 Then
      wks.QueryTables(1).Refresh
    End If

    Set wks = Nothing
End Sub