Upper Syntax

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hi,

Can any one here to tell the trick?

Public Function doll()
Dim i
For i = 2 To 5
If Cells(i, 2) = "yes" Then
Cells(i, 3) = Cells(i, 2)
Else
If Cells(i, 2) <> "yes" Then
Cells(i, 3) = UPPER(Cells(i, 2)) ....i wanted here in cells(i,3) to UPPER the letter, but i dont know how can do, bcoz the using one is wrong
End If
End If
Next
End Function
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Rich (BB code):
Cells(i, 3).Value = UCase(Cells(i, 2).Value)
 
Upvote 0
GTO, one more a less query.

suppose the same, any cell contain - (supposing this data will come in excel sheet)
cells(2,3)= "yes tpd io"
cell(3,3) = "no tpd other"

Can this i make like this, or possible,
In coding,

if cells(i,2) = "yes" AND "no"
skip this content and do UPPER rest contain in cell?

I hope offcource, excel provide this functinality also.
 
Upvote 0
I am afraid I am not understanding this part: if cells(i,2) = "yes" AND "no"
 
Upvote 0
Let me again exlpain You and also i paste the code following you see, which i tried to update, that is also help you to understand.

Public Function doll()
Dim dl
For dl = 9 To 600
If Cells(dl, 5) = "kV" Or "to" Or "NaOH" Or "Na2CO3" Then
Cells(dl, 5) = Cells(dl, 5) (editing) ....even this also wrong
Else
If Cells(dl, 5) <> "kV" Or "to" Or "NaOH" Or "Na2CO3" Then
Cells(dl, 5).Value = UCase(Cells(dl, 5).Value)
End If
End If
Next
End Function

now you can see, if in col F, any cell value having a single value say, "yes"
this is off cource not matter to get in UPPER case.
But, if in col F, any cell value, that contain "chicks Na2Co3" ....this is may the data like comes in this order also "Na2Co3 chicks yep" or "yahoooo NaOH hi".

here, only chicks should get in UPPPER, and Na2Co3 will remain same.

I hope, this makes you to clear Dear?
 
Upvote 0
Okay, I think I understand. You are just mis-writing the test a bit.

Try:
Rich (BB code):
Public Function doll()
Dim dl As Long
    
    For dl = 9 To 600
        If Cells(dl, 5).Value = "kV" Or Cells(dl, 5).Value = "to" Or Cells(dl, 5).Value = "NaOH" Or Cells(dl, 5).Value = "Na2CO3" Then
            Cells(dl, 5).Value = Cells(dl, 5).Value
        Else
            If Cells(dl, 5).Value <> "kV" Or Cells(dl, 5).Value <> "to" Or Cells(dl, 5).Value <> "NaOH" Or Cells(dl, 5).Value <> "Na2CO3" Then
                Cells(dl, 5).Value = UCase(Cells(dl, 5).Value)
            End If
        End If
    Next
End Function
 
Upvote 0
Thank You very much for great mind share with me.
This is done Upper, but still the condition we wrote, that is done succesfully.
Boz even, kV or those dont want to go with Upper dat is also did.
ok.

Actually we have,,,, you know dat syntax we use for "find" purpose.
In that, we write that, "Look At:".
If we find by this cell contain then it might could done.
Also tryed, hope, if u getting, it is request you and all member, pls be with me with great mind and solution.
Thanks Alot, GTO.
 
Upvote 0
My bad, I only looked at the construction and not what you are trying to do.

It appears to me that as we loop through the cells, if the cell value is any of the following: "kV" , "to" , "NaOH" , "Na2CO3"

Then we are simply assigning the value of the cell to itself.

If the cell's value is not one of the above, we jus want to change whatever is in the cell to UCASE. Is that a fair description of your goal?
 
Upvote 0
Pls Forgive.

My Mistake, Query wrote on wrong. In xcitement, i did the wrong thing. I understnad.

those cells content does not contain, any of this,
kV" , "to" , "NaOH" , "Na2CO3"
Those go with Upper Case.

and
those cells content contain, any of this,
kV" , "to" , "NaOH" , "Na2CO3"
Only the remaining string go with Upper Case, and this above remain as it is.
e.g.- "heater to heater"
answer should be = "HEATER to HEATER"

I understand my query is wrong.
Extremely Sorry.
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,473
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top