Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 23rd, 2006, 09:34 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
Exclamation VB for Apps - Comparison Operator Issue

I'm required to display range names beginning with the 3 letters "Reg", using the UCase function and the Like operator. Why doesn't my Excel macro work as follows? Thank you.
Public Sub Display()
Dim intMessage As Integer, r As Integer, nms As Object
Set nms = ActiveWorkbook.Names
For r = 1 To nms.Count
If UCase(nms(r)) Like UCase("Reg *") Then
intMessage = MsgBox("Range name " & r & ": " & nms(r).Name)
End If
Next
End Sub

Reply With Quote
  #2  
Old October 24th, 2006, 01:25 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
what's wrong with simple comparison??
Code:
If UCase(Left(nms(r), Len("REG")))="REG" Then
Comments on this post
DonaldRennie agrees!

Reply With Quote
  #3  
Old October 24th, 2006, 10:44 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
Exclamation Didn't Work - Sorry

Thank you for your responce, but, unfortunately my msgBox is still not appearing, and I'm supposed to use the 'Like' operator.

Reply With Quote
  #4  
Old October 25th, 2006, 01:19 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
I'm not familiar with the LIKE command, so I tried to use something
I do know. you get error?
if not, debug may help:
Code:
MsgBox("value: " & nms(r))

what you see in the message?

Reply With Quote
  #5  
Old October 25th, 2006, 06:19 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
I found the answer. Problem solved. Thanks.

Reply With Quote
  #6  
Old October 26th, 2006, 01:59 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
can you please share it for others who might have the same problem?

Reply With Quote
  #7  
Old October 31st, 2006, 11:56 PM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
Lightbulb The Solution

I'm sorry. Yes Shadow, of course. Here it is:

Dim nsm As Name

'Display only range names that start with "Reg"
For Each nms In Names
If UCase(nms.Name) Like UCase("Reg*") Then
intMessage = MsgBox("Range name: " & nms.Name)
End If
Next

Reply With Quote
  #8  
Old November 1st, 2006, 12:41 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
so the problem was the blank space after "Reg".. ?

Reply With Quote
  #9  
Old November 1st, 2006, 08:22 AM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
Solution

Well, I tried it without the space before and it didn't help. Then I was told that I needed to use a "For each" instead of the "For" clause. I don't know why. Then I was to dim nsm as Name, not an object. That part makes sense. Did you see my new post about the Word macro I'm having trouble with? I need code that would place the insertion point in the last row of a table.

Reply With Quote
  #10  
Old November 1st, 2006, 09:02 AM
DonaldRennie DonaldRennie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: South Carolina (Wish I was in Vegas)
Posts: 14 DonaldRennie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 12 sec
Reputation Power: 0
I tried to add to your rep for your effort, but there's only a zero in the drop-down box. So, I tried to send a private message to let you know, but that was disabled. Then I checked out the knowledgebase and troubleshooting links for answers: I don't have Norton, I turned down my security settings. Those suggestions didn't work. Then, I tried to submit an email to the support link. That was disabled. I verified that I'm logged on, and my new account has been activated. This is strange!

Reply With Quote
  #11  
Old November 2nd, 2006, 12:16 AM
micky's Avatar
micky micky is offline
Couch Potato Wizard
Click here for more information. Click here for more information
 
Join Date: Jan 2005
Location: India
Posts: 10,503 micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)micky User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 1480 Folding Title: Novice Folder
Time spent in forums: 3 Months 4 Weeks 12 h 41 m 23 sec
Reputation Power: 1455
Hey Donald, right now u have only 0 rep power, so u can give only 0 rep points to anyone. Regarding Private message, try again........ u must have tried it when ur post count were less than 10......... now u have 12 posts, so u can send Private message now.
__________________
Laziness is my religion and Sunday is my God

Get the Mantra!

Reply With Quote
  #12  
Old November 2nd, 2006, 12:24 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,942 Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 8th Grade (Above 100000 Reputation Level)  Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1Folding Points: 340699 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 5 Days 12 h 47 m 26 sec
Reputation Power: 1537
Quote:
Originally Posted by DonaldRennie
Well, I tried it without the space before and it didn't help. Then I was told that I needed to use a "For each" instead of the "For" clause. I don't know why. Then I was to dim nsm as Name, not an object. That part makes sense. Did you see my new post about the Word macro I'm having trouble with? I need code that would place the insertion point in the last row of a table.
well, I'm really not into Excel programming, I guess they changed
some things in there. glad you could find the solution!
as for your new thread I really have no idea, sorry.

regarding the restrictions, they were put into place to protect
our forum from spammers - until you have 30 posts and member
for 30 days you're not considered full member thus have many
restrictions on your account. you can blame the spammers for
this, and if you stick around you'll become full member shortly.

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > VB for Apps - Comparison Operator Issue


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread <