Forum Discussion
List Validation
- Jun 04, 2019
Hi the follwing code is behind class "Thisworkbook" ("DieseArbeitsmappe"). See attached file.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Select Case Sh.Name
Case "Sheet1"
Select Case Target.Column
Case 3, 4 'Column C+D
If Target.Row > 6 Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
Case Else
End Select
Case "Sheet2"
'other rules
End Select
End SubRegards
Bernd
http://www.vba-tanker.com - a database full of excel macros
Berndvbatanker Oh, it's attached to the whole sheet but ignored outside of column A because of your first line of code?
Ummm… I was going to attach it to specific cells. But if this is the way to do it, how could I restrict the code to apply to Columns C and D, rows 6+ only?
I need to do something similar on other sheets in the same workbook. So should I attach it to the workbook as a whole and include code in the function so that it is only triggered for specific cells on each sheet? If so, could you show me an example of that in the code, please?
Thanks again.
Hi the follwing code is behind class "Thisworkbook" ("DieseArbeitsmappe"). See attached file.
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Select Case Sh.Name
Case "Sheet1"
Select Case Target.Column
Case 3, 4 'Column C+D
If Target.Row > 6 Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
Case Else
End Select
Case "Sheet2"
'other rules
End Select
End Sub
Regards
Bernd
http://www.vba-tanker.com - a database full of excel macros
- bvelkeJun 05, 2019Brass Contributor
Berndvbatanker That's great. I learned a lot from that code example. Thanks!