Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Can I get VBA script to read a word with both lcase and ucase lett

Hi!
I am using this script but it can only read text with small letters. Can I
change it to read with both small and big letters:

Case Is = "i13"
If LCase(.Value) = LCase("select door") Then
'skipit
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can I get VBA script to read a word with both lcase and ucase lett

Hi Calle,

Using LCase on both sides of the comparison expression reders the test case
insensitive and, consequently, your code should accept the sought text in
any casr, or mix of cases.


---
Regards,
Norman



"Calle" wrote in message
...
Hi!
I am using this script but it can only read text with small letters. Can I
change it to read with both small and big letters:

Case Is = "i13"
If LCase(.Value) = LCase("select door") Then
'skipit
End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Can I get VBA script to read a word with both lcase and ucase

ok, thx I try that. one more question. Is ther a way to get a script to
delete content in merged cells. I can only get the script to delete in
normal cells.

script:

Case Is = "i17"
If LCase(.Value) = LCase("clear") Then
Selection.Offset(1, -2).ClearContents
Else
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can I get VBA script to read a word with both lcase and ucase

Hi Calle,

Try:

Case Is = "i17"
If LCase(.Value) = LCase("clear") Then
With Selection.Offset(1, -2)
If .MergeCells Then
.MergeArea.ClearContents
Else
.ClearContents
End If
End With
Else



---
Regards,
Norman


"Calle" wrote in message
...
ok, thx I try that. one more question. Is ther a way to get a script to
delete content in merged cells. I can only get the script to delete in
normal cells.

script:

Case Is = "i17"
If LCase(.Value) = LCase("clear") Then
Selection.Offset(1, -2).ClearContents
Else



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Can I get VBA script to read a word with both lcase and ucase

thx for the reply ! :)


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can I get VBA script to read a word with both lcase and ucase

One way:
Selection.Offset(1, -2).value = ""

Calle wrote:

ok, thx I try that. one more question. Is ther a way to get a script to
delete content in merged cells. I can only get the script to delete in
normal cells.

script:

Case Is = "i17"
If LCase(.Value) = LCase("clear") Then
Selection.Offset(1, -2).ClearContents
Else


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Can I get VBA script to read a word with both lcase and ucase

Hi Dave,

A much simpler answer!

I never use merged cells - and it shows!

---
Regards,
Norman



"Dave Peterson" wrote in message
...
One way:
Selection.Offset(1, -2).value = ""




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Can I get VBA script to read a word with both lcase and ucase

I would think that this would work, too:
Selection.Offset(1, -2).MergeArea.ClearContents
even if the range isn't merged.

(untested, though)

Norman Jones wrote:

Hi Dave,

A much simpler answer!

I never use merged cells - and it shows!

---
Regards,
Norman

"Dave Peterson" wrote in message
...
One way:
Selection.Offset(1, -2).value = ""


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Can I get VBA script to read a word with both lcase and ucase lett

If you put

Option Compare Text

at the very top of your module, text comparisons are
automatically done case-insensitive, so there is no need for the
conversion to LCase.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Calle" wrote in message
...
Hi!
I am using this script but it can only read text with small
letters. Can I
change it to read with both small and big letters:

Case Is = "i13"
If LCase(.Value) = LCase("select door") Then
'skipit
End If



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone know of a way, or have a script, to read a TOC from CD's? Bob Parker Excel Programming 1 June 25th 05 09:48 PM
Read only password script box Joey041 Excel Discussion (Misc queries) 1 May 3rd 05 01:23 AM
Get…UCase or LCase ??? Totmos Excel Programming 0 January 8th 04 07:09 PM
Get…UCase or LCase ??? Totmos Excel Programming 2 January 8th 04 06:15 PM


All times are GMT +1. The time now is 03:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"