
Signature
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
Hi, and thanks. This is very cool. I have a couple of questions.
I know nothing about macros so here goes.
In your code there is a line here: aryWords = Array("as", "wb",
"sa", "crc")
I have a list of 50 or 60 names I want to be effected by the macro.
Do I have to manually input them here, or can I put in a range, etc.?
My second question has to do with the cell where I want the
capitalization to happen. As it stands, any cell where I input the
selected criteria will capitalize it. Can I make it happen only in
cell C2?
Thanks again, it's much appreciated. Very interesting. I'll be
studying this.
RF
>A macro solution
>
[quoted text clipped - 20 lines]
>'code module. To do this, right-click on the sheet tab, select
>'the View Code option from the menu, and paste the code in.
Bob Phillips - 14 Aug 2007 19:53 GMT
> Hi, and thanks. This is very cool. I have a couple of questions.
> I know nothing about macros so here goes.
[quoted text clipped - 4 lines]
> I have a list of 50 or 60 names I want to be effected by the macro.
> Do I have to manually input them here, or can I put in a range, etc.?
Of course, just takes a tad more code
aryWords = Application.Transpose(Range("A1:A10"))
> My second question has to do with the cell where I want the
> capitalization to happen. As it stands, any cell where I input the
> selected criteria will capitalize it. Can I make it happen only in
> cell C2?
Again yes, but more code again.
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2" '<== change to suit
Dim aryWords
On Error GoTo ws_exit
Application.EnableEvents = False
aryWords = Application.Transpose(Worksheets("Sheet1").Range("A1:A60"))
If Not Intersect(Target, Me.renge(WS_RANGE)) Is Nothing Then
With Target
If Not IsError(Application.Match(LCase(.Value), aryWords, 0))
Then
.Value = UCase(.Value)
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
RF - 14 Aug 2007 20:45 GMT
Thanks again. For some reason I didn't need to do the second part.
it worked just fine after I made the first change.
I appreciate your time.
RF
>> Hi, and thanks. This is very cool. I have a couple of questions.
>> I know nothing about macros so here goes.
[quoted text clipped - 36 lines]
> Application.EnableEvents = True
>End Sub