Force uppercase into a cell from a textbox
Posted by Sid on July 22, 2001 4:56 AM
I am using this to force uppercase in the linked cell
Private Sub TextBox2_Change()
Dim rCells As Range
For Each rCells In Selection
rCells = UCase(rCells.Text)
Next
End Sub
It works, but after it is used it cancels the following located on another sheet in the same workbook
Private Sub Worksheet_Change(ByVal Target As Range)
'Prevent spaces in fitting list
Dim c As Object
Dim Offender As String
For Each c In Target.Cells
If Left(c, 1) = " " Then
Offender = c.Address
MsgBox "Mr. NSI - If you start the Fitting No. with a space character you will not be able to search for it later!", vbExclamation
Application.Undo
End If
Next
'Insert Date next to name
Dim keyRange As Range
Set keyRange = Range("h3:h65536", "J3:J65336")
Application.EnableEvents = False
If Not Intersect(keyRange, Target) Is Nothing Then
If Target <> "" Then
Target.Offset(0, 1) = Date
Else
Target.Offset(0, 1) = ""
End If
End If
Application.EnableEvents = True
'Make uppercase
Dim rCells As Range
Application.EnableEvents = False
If Not Intersect(Target, Columns("f:f")) Is Nothing Then
For Each rCells In Intersect(Target, Columns("f:f"))
rCells = UCase(rCells.Text)
Next
End If
Application.EnableEvents = True
End Sub
The above works fine until the textbox is used.
Any ideas much appreciated
Cheers Sid