View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Grant Reid Grant Reid is offline
external usenet poster
 
Posts: 51
Default "Not" and "Not Like"

Hi

Many thanks to those who reponded , but...... I'm still not getting the
expected result. I'm trying to refresh all query tables in the workbook,
except for a worksheet named "Admin" and all worksheets with a naming
convention of "Server 1 Database Space Summary", "Server 2 Database Space
Summary", "Server 3 Database Space Summary" etc etc. I've tried variations
of the responses posted thus far but without success. Perhaps I'm missing
the obvious or hitting a late afternoon blank. I've re-posted my code below
hoping that someone will highlight the problem for me. Many thanks in
advance

Sub RefreshExisting()

Dim qt As QueryTable
Dim WSh As Worksheet
Dim strQueryName As String

For Each WSh In ThisWorkbook.Worksheets
For Each qt In WSh.QueryTables
strQueryName = WSh.Range("AM2")
If WSh.Name < "Admin" And WSh.Name < "Server * Projection Seed
Values" Then
If InStr(qt.Name, strQueryName) Then
qt.Refresh BackgroundQuery:=False
End If
End If
Next qt
Next WSh
End Sub

Kind Regards - Grant