Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Ignore case of text in code

Hi all, I have a spread sheet that i am copying the entire line if
column 4 has the letters "lc" in, it works great as long as the letter
case is lower. If a user puts the case, in the system that the
spreadsheet gets it's information from, in upper case then my code will
ignore it.
Is there a way to "Ignore the case" that i can use ??
The code i use is below.

ANy help would be much appreciated.

Sub OnlyLcLcParts()
'
Dim todaysDateLong As String
Dim sh1 As Worksheet, sh2 As Worksheet
Dim rng1 As Range, cell As Range
Dim rw As Long, Gpls As Date, tDay As Date
Dim res As Variant, dDiff As Long
' Range("A1").Select
Set sh1 = Worksheets("ALL LC PARTS")
Set sh2 = Worksheets("QUALITY PARTS")
rw = 2
Set rng1 = sh1.Range(sh1.Cells(3, 1), sh1.Cells(3, 1).End(xlDown))
For Each cell In rng1
If Application.CountIf(rng1, cell.Value) = 0 Then

Else
If cell.Offset(0, 4) = "lc" Then '*** Data ****
cell.EntireRow.Copy sh2.Cells(rw, 1)
rw = rw + 1
End If
End If
Next
' PctDone = Counter + 0.35 '---1
' Call UpdateProgress1(PctDone)
ColorWhenValueChangeRepLc
End Sub


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Ignore case of text in code

You can change ALL text comparisons in a module to ignore case by placing
Option Compare Text as the first line in the module, right up there with
Option Explicit. For a single conversions, use

change
If cell.Offset(0, 4) = "lc" Then '*** Data ****
to
If StrComp(Cell.Offset(0,4),"lc",vbTextCompare) = 0 Then "***Data***"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Les Stout" wrote in message
...
Hi all, I have a spread sheet that i am copying the entire line if
column 4 has the letters "lc" in, it works great as long as the letter
case is lower. If a user puts the case, in the system that the
spreadsheet gets it's information from, in upper case then my code will
ignore it.
Is there a way to "Ignore the case" that i can use ??
The code i use is below.

ANy help would be much appreciated.

Sub OnlyLcLcParts()
'
Dim todaysDateLong As String
Dim sh1 As Worksheet, sh2 As Worksheet
Dim rng1 As Range, cell As Range
Dim rw As Long, Gpls As Date, tDay As Date
Dim res As Variant, dDiff As Long
' Range("A1").Select
Set sh1 = Worksheets("ALL LC PARTS")
Set sh2 = Worksheets("QUALITY PARTS")
rw = 2
Set rng1 = sh1.Range(sh1.Cells(3, 1), sh1.Cells(3, 1).End(xlDown))
For Each cell In rng1
If Application.CountIf(rng1, cell.Value) = 0 Then

Else
If cell.Offset(0, 4) = "lc" Then '*** Data ****
cell.EntireRow.Copy sh2.Cells(rw, 1)
rw = rw + 1
End If
End If
Next
' PctDone = Counter + 0.35 '---1
' Call UpdateProgress1(PctDone)
ColorWhenValueChangeRepLc
End Sub


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Ignore case of text in code

On Nov 28, 9:20 am, Les Stout wrote:
Hi all, I have a spread sheet that i am copying the entire line if
column 4 has the letters "lc" in, it works great as long as the letter
case is lower. If a user puts the case, in the system that the
spreadsheet gets it's information from, in upper case then my code will
ignore it.
Is there a way to "Ignore the case" that i can use ??
The code i use is below.

ANy help would be much appreciated.

Sub OnlyLcLcParts()
'
Dim todaysDateLong As String
Dim sh1 As Worksheet, sh2 As Worksheet
Dim rng1 As Range, cell As Range
Dim rw As Long, Gpls As Date, tDay As Date
Dim res As Variant, dDiff As Long
' Range("A1").Select
Set sh1 = Worksheets("ALL LC PARTS")
Set sh2 = Worksheets("QUALITY PARTS")
rw = 2
Set rng1 = sh1.Range(sh1.Cells(3, 1), sh1.Cells(3, 1).End(xlDown))
For Each cell In rng1
If Application.CountIf(rng1, cell.Value) = 0 Then

Else
If cell.Offset(0, 4) = "lc" Then '*** Data ****
cell.EntireRow.Copy sh2.Cells(rw, 1)
rw = rw + 1
End If
End If
Next
' PctDone = Counter + 0.35 '---1
' Call UpdateProgress1(PctDone)
ColorWhenValueChangeRepLc
End Sub

Best regards,

Les Stout

*** Sent via Developersdexhttp://www.developersdex.com***


Hi
Replace
cell.Offset(0, 4) = "lc"
with
lcase(cell.Offset(0, 4)) = "lc"

regards
Paul
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Ignore case of text in code

Thanks so much Chip, much appreciated...

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Ignore case of text in code

Thanks for your reply Paul, much appreciated.

Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
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
Changing multiple cell text from lower case to upper case Patti Excel Discussion (Misc queries) 2 January 4th 08 08:35 PM
vlookup -- Upper case and Lower case text teec_detroit Excel Discussion (Misc queries) 1 August 6th 07 04:40 PM
Compare Worksheet Names - Ignore Case? Trader_in_Paradise Excel Programming 3 May 12th 07 12:31 AM
Change the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
How do I change existing text from lower case to upper case CT Cameron Excel Discussion (Misc queries) 2 November 30th 04 01:07 AM


All times are GMT +1. The time now is 12:41 PM.

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"