mloucel
New Member
- Joined
- Feb 22, 2016
- Messages
- 37
Good (Morning/Afternoon) Gurus
I am a newbie and still learning by myself with your help..
I have to check in my worksheet for some cells if they are empty once the user enter his/her name:
<tbody>
</tbody>
So when Mary uses the WS she has to Input the first 4 fields then she enters her name
at that point I need to check if there is no data on date, fname, lname, phone all must contain
data, if all or any is empty (or len=0) then simply display a message.
I have to evaluate everytime someone is entering data in every row.
I have the Idea of what I want I just don't know how to do it..
this is my TEST CODE and the place I believe it should be, as you can see I am already checking
some other stuff and even moving all the TXT cells to Uppercase..
I DID try to create the same code as the one in BLUE but of course it was a total failure (I DELETE THE CODE IN FRUSTRATION).
Thank you in advance for your help.. (A NEWBIE)
I am a newbie and still learning by myself with your help..
I have to check in my worksheet for some cells if they are empty once the user enter his/her name:
date | FName | LName | Phone | Input By |
Peter | Parker | Mary | ||
03/01/2016 | (111) 222-3333 | John |
<tbody>
</tbody>
So when Mary uses the WS she has to Input the first 4 fields then she enters her name
at that point I need to check if there is no data on date, fname, lname, phone all must contain
data, if all or any is empty (or len=0) then simply display a message.
I have to evaluate everytime someone is entering data in every row.
I have the Idea of what I want I just don't know how to do it..
this is my TEST CODE and the place I believe it should be, as you can see I am already checking
some other stuff and even moving all the TXT cells to Uppercase..
I DID try to create the same code as the one in BLUE but of course it was a total failure (I DELETE THE CODE IN FRUSTRATION).
Thank you in advance for your help.. (A NEWBIE)
Code:
' Following code corrected 03/08/2016 by MrExcel Forum gurus.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range, otherRange As Range, rngCell As Range
Application.EnableEvents = False
Set otherRange = Intersect(Target, Range("G2:G1500, H2:H1500, N2:N1500, R2:R1500, T2:U1500, AB2:AB1500"))
Set myRange = Intersect(Target, Range("AG2:AG1500, AI2:AI1500, AK2:AK1500"))
[B][COLOR=#0000ff] Set TestInRange = Intersect(Target, Range("F2:F1500, G2:G1500, H2:H1500"))[/COLOR][/B]
[COLOR=#ff0000][B] If Len(r2) = 0 Then[/B][/COLOR]
[COLOR=#ff0000][B] MsgBox " F G H I are blank"[/B][/COLOR]
[COLOR=#ff0000][B] End If[/B][/COLOR]
[B][COLOR=#0000ff] If Not otherRange Is Nothing Then[/COLOR][/B]
[B][COLOR=#0000ff] For Each rngCell In otherRange[/COLOR][/B]
[B][COLOR=#0000ff] rngCell.Value = UCase(rngCell.Value)[/COLOR][/B]
[B][COLOR=#0000ff] Next rngCell[/COLOR][/B]
[B][COLOR=#0000ff] End If[/COLOR][/B]
If Not myRange Is Nothing Then
For Each rngCell In myRange
If Len(rngCell) Then
rngCell.Value = UCase(rngCell.Value)
If Len(rngCell.Offset(, -1)) = 0 Then rngCell.Offset(, -1).Value = Date
Else
rngCell.Offset(, -1).ClearContents
End If
Next rngCell
End If
Application.EnableEvents = True
End Sub