Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
If WSh.Name < "Admin" and < "Server * Projection Seed Values"
First of all, this line lacks 'WSh.Name' before '< "Server *... ' Obviously this test will not perform a LIKE compare. To solve your problem, you can do so: If WSh.Name < "Admin" and Left(WShName, 7) < "Server " and Right(WShName, 23) < " Projection Seed Values" Then Be attention: "Server " ends with a space, " Projection Seed Values" begins with a space. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
Hi
I need to perform arbitary actions on all sheets in my workbook except for a sheet with the name "Admin" and any sheets with the following naming convention "Server * Projection Seed Values". Am at my wits end with this one. Can anyone help. See my code below; Dim qt As QueryTable Dim WSh As Worksheet For Each WSh In ThisWorkbook.Worksheets If WSh.Name < "Admin" and < "Server * Projection Seed Values" Then '<------ This is the problem area 'Perform action here End If Next WSh End Sub Many Thanks - Grant |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
If WSh.Name < "Admin" and Left(WShName, 7) < "Server " and Right(WShName, 23) < " Projection Seed Values" Then ahem... I wrote "WShName" instead of "WSh.Name" |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
Hi Grant,
You need to add WSh.name to the second part of the test as well. If WSh.Name < "Admin" and WSh.Name < "Server * Projection Seed Values" Then Cheers Andy Grant Reid wrote: Hi I need to perform arbitary actions on all sheets in my workbook except for a sheet with the name "Admin" and any sheets with the following naming convention "Server * Projection Seed Values". Am at my wits end with this one. Can anyone help. See my code below; Dim qt As QueryTable Dim WSh As Worksheet For Each WSh In ThisWorkbook.Worksheets If WSh.Name < "Admin" and < "Server * Projection Seed Values" Then '<------ This is the problem area 'Perform action here End If Next WSh End Sub Many Thanks - Grant -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
If WSh.Name < "Admin" and (Left(WShName, 7) < "Server " OR Right(WShName,
23) < " Projection Seed Values") Then 7 and 23 are lengths of "Server " and " Projection Seed Values" |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
"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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
If WSh.Name < "Admin" and _ Not WSh.Name like "Server * Projection Seed Values" Then -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Grant Reid" wrote in message ... Hi I need to perform arbitary actions on all sheets in my workbook except for a sheet with the name "Admin" and any sheets with the following naming convention "Server * Projection Seed Values". Am at my wits end with this one. Can anyone help. See my code below; Dim qt As QueryTable Dim WSh As Worksheet For Each WSh In ThisWorkbook.Worksheets If WSh.Name < "Admin" and < "Server * Projection Seed Values" Then '<------ This is the problem area 'Perform action here End If Next WSh End Sub Many Thanks - Grant |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
Does it works? Which solution have you used?
|
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
Hi
Many thanks to all who responded. Kind Regards - Grant |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
Hi Francesco
I tried all the suggestions and the only ones that did the trick for me were the solutions posted by you and Bob. Very elegant, both of them. I do not know why the solution posted by Andy did'nt do it for me. Perhaps it was late afternoon brain-fog ;-) Once again, many thanks to you all Kind Regards - Grant |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
and I had thought my little gem had got lost in all the fog<vbg
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Grant Reid" wrote in message ... Hi Francesco I tried all the suggestions and the only ones that did the trick for me were the solutions posted by you and Bob. Very elegant, both of them. I do not know why the solution posted by Andy did'nt do it for me. Perhaps it was late afternoon brain-fog ;-) Once again, many thanks to you all Kind Regards - Grant |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
"Not" and "Not Like"
I left out the LIKE operator.
Grant Reid wrote: Hi Francesco I tried all the suggestions and the only ones that did the trick for me were the solutions posted by you and Bob. Very elegant, both of them. I do not know why the solution posted by Andy did'nt do it for me. Perhaps it was late afternoon brain-fog ;-) Once again, many thanks to you all Kind Regards - Grant -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
correct syntax for nesting "if", "and", and "vlookup"....if possib | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |