-
Solved: Message box for offset column
I have code that provides a message box if the user tries to "move on" to the next column of their without putting any data in. This in turn sends the user back to that column and row. The trouble with it is a couple of things; The messagebox comes out long and stretched, I imagine its because of the VBA code.
[VBA]If Not Intersect(Target, Range("D3:J10000")) Is Nothing Then
If Target.Offset(0, -1).Value = "" Then
MsgBox "Some information has been missed.Please enter information in previous column labelled " & Cells(2, Target.Column - 1).Value, vbOKOnly
Target.Offset(0, -1).Select
End If
End If
End Sub
[/VBA]
At present the code is written for columns "D" to "J". this offset does not take into account column "J" so data can be missed.
To make it more complicated the workbook has to be accessed by three other departments. Their columns are "K to "N" and "O to "R" and "S" to "V" respectively.
Can I get this code to work independantly of each set of columns and ensuring that the end column of each set is filled in.
This has had me stumped for hours because all I have to work with is the offset code and I haven't the knowledge to change it.
Can I change my messagebox to a warning box or something, I would still just need the OK button because the user doesn't need a choice.
If anyone can help put me out of my misery with this, I appreciate it.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules