ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I get VBA script to read a word with both lcase and ucase lett (https://www.excelbanter.com/excel-programming/366515-can-i-get-vba-script-read-word-both-lcase-ucase-lett.html)

Calle

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

Norman Jones

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




Calle

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

Norman Jones

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




Dave Peterson

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

Calle

Can I get VBA script to read a word with both lcase and ucase
 
thx for the reply ! :)

Norman Jones

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 = ""





Dave Peterson

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

Chip Pearson

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





All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com