Nice video - except that there is no "Close and load to..." option (greyed out), and before that there no "View native query" in the Navigation pull down .... Is there now now way of writing queries in SQL in MS Excel ????? I can do complex things in SQL ... with the new Power Query I can't even figure out how to get a HAVING clause, let alone make a query which lists all records from one excel table with a duplicate key value (in column A). I can do that in SQL though ..... if SQL was available
Hi Gagan , Use the below code and remember to change your query table name in it . Private Sub Worksheet_Change(ByVal Target As Range)
Dim tbl As ListObject Set tbl = Me.ListObjects("Your Query Tabel Name Here") If Not Intersect(Target, tbl.Range) Is Nothing Then ActiveWorkbook.RefreshAll End If End Sub
@@RealOfficeWiz - which query table i have to mention or I have apply vba code to the entire worksheet or i have to select the query box table ... my table from sql server is tblemployee
You need to apply vba only on the sheet where your second table is,in which you write sql queries. Same table name you need to mention in the vba code. :)
Great video. Can you please also show how to use join in the native query?
Nice video - except that there is no "Close and load to..." option (greyed out), and before that there no "View native query" in the Navigation pull down ....
Is there now now way of writing queries in SQL in MS Excel ?????
I can do complex things in SQL ... with the new Power Query I can't even figure out how to get a HAVING clause, let alone make a query which lists all records from one excel table with a duplicate key value (in column A). I can do that in SQL though ..... if SQL was available
Please share the vba code
Hi Gagan , Use the below code and remember to change your query table name in it .
Private Sub Worksheet_Change(ByVal Target As Range)
Dim tbl As ListObject
Set tbl = Me.ListObjects("Your Query Tabel Name Here")
If Not Intersect(Target, tbl.Range) Is Nothing Then
ActiveWorkbook.RefreshAll
End If
End Sub
@@RealOfficeWiz- thank you so much
@@RealOfficeWiz - which query table i have to mention or I have apply vba code to the entire worksheet or i have to select the query box table ... my table from sql server is tblemployee
You need to apply vba only on the sheet where your second table is,in which you write sql queries. Same table name you need to mention in the vba code. :)