Hi,
I have this code:
Modules --> Module1:
Sheet1:
My problem is in the Find = statement in the function.
I've walked this through the debugger. The Find function is finding the "Applicable" column fine (column 2). But how do I convert the aCell object to a range so that Intersect will be true, and will uppercase the cell value that was updated? If I were hardcoding this, I would return Range("B:B").
Thanks,
Scott
I have this code:
Modules --> Module1:
Code:
Function Find(strSearch As String) As Range
Dim aCell As Range
Set aCell = ActiveSheet.Rows(1).Find(What:=strSearch, LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not aCell Is Nothing Then
Find = Range(Columns(aCell.Column), Columns(aCell.Column))
End If
End Function
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Whoops
Application.EnableEvents = False
If Not Intersect(Target, Find("Applicable")) Is Nothing Then
If Not Target.HasFormula Then
Target.Value = UCase(Target.Value)
End If
End If
Whoops:
Application.EnableEvents = True
End Sub
My problem is in the Find = statement in the function.
I've walked this through the debugger. The Find function is finding the "Applicable" column fine (column 2). But how do I convert the aCell object to a range so that Intersect will be true, and will uppercase the cell value that was updated? If I were hardcoding this, I would return Range("B:B").
Thanks,
Scott