ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with code... (https://www.excelbanter.com/excel-programming/332596-help-code.html)

KimberlyC

Help with code...
 
Hi,
I'm using the following code to make the user enter data into cells E7: BF7
before they enter data into cells E9:BF1000
It's working great!
But, now I want to try to modify the code for another worksheet where I only
need to apply this to column A.
I need to not allow the user to enter data into cells A10:A1000 unless they
have entered data into cell A9.
I've tried to alter this code to do that...but I had no luck!!


If Target.Cells.Count 1 Then Exit Sub

If Target.Cells(1).Row = 9 _
And Target.Cells(1).Row <= 1000 _
And Target.Cells(1).Column = 5 _
And Target.Cells(1).Column <= 58 Then

If Target.Parent.Cells(7, Target.Cells(1).Column).Value = "" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox " This column needs a heading!!You must enter a heading
in cell 7 above. Once the heading is entered into cell 7, you will be able
to enter data into this column.", vbOKOnly, "Column Label Required in Cell &
above"
Target.Parent.Cells(7, Target.Cells(1).Column).Select
End If
End If


Any help is greatly appreicated!!!
Thanks in advance!
Kimberly



Vasant Nanavati

Help with code...
 
Try (untested):

If Target.Cells.Count 1 Then Exit Sub

If Target.Cells(1).Row = 10 _
And Target.Cells(1).Row <= 1000 _
And Target.Cells(1).Column = 1 _
Then

If Target.Parent.Cells(9, Target.Cells(1).Column).Value = "" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox " This column needs a heading!!You must enter a heading
in cell 9 above. Once the heading is entered into cell 9, you will be able
to enter data into this column.", vbOKOnly, "Column Label Required in Cell &
above"
Target.Parent.Cells(9, Target.Cells(1).Column).Select
End If
End If

--

Vasant


"KimberlyC" wrote in message
...
Hi,
I'm using the following code to make the user enter data into cells E7:
BF7
before they enter data into cells E9:BF1000
It's working great!
But, now I want to try to modify the code for another worksheet where I
only
need to apply this to column A.
I need to not allow the user to enter data into cells A10:A1000 unless
they
have entered data into cell A9.
I've tried to alter this code to do that...but I had no luck!!


If Target.Cells.Count 1 Then Exit Sub

If Target.Cells(1).Row = 9 _
And Target.Cells(1).Row <= 1000 _
And Target.Cells(1).Column = 5 _
And Target.Cells(1).Column <= 58 Then

If Target.Parent.Cells(7, Target.Cells(1).Column).Value = "" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox " This column needs a heading!!You must enter a heading
in cell 7 above. Once the heading is entered into cell 7, you will be able
to enter data into this column.", vbOKOnly, "Column Label Required in Cell
&
above"
Target.Parent.Cells(7, Target.Cells(1).Column).Select
End If
End If


Any help is greatly appreicated!!!
Thanks in advance!
Kimberly





KimberlyC

Help with code...
 
Thanks!!!
That worked great! :)
"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Try (untested):

If Target.Cells.Count 1 Then Exit Sub

If Target.Cells(1).Row = 10 _
And Target.Cells(1).Row <= 1000 _
And Target.Cells(1).Column = 1 _
Then

If Target.Parent.Cells(9, Target.Cells(1).Column).Value = "" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox " This column needs a heading!!You must enter a heading
in cell 9 above. Once the heading is entered into cell 9, you will be able
to enter data into this column.", vbOKOnly, "Column Label Required in Cell

&
above"
Target.Parent.Cells(9, Target.Cells(1).Column).Select
End If
End If

--

Vasant


"KimberlyC" wrote in message
...
Hi,
I'm using the following code to make the user enter data into cells E7:
BF7
before they enter data into cells E9:BF1000
It's working great!
But, now I want to try to modify the code for another worksheet where I
only
need to apply this to column A.
I need to not allow the user to enter data into cells A10:A1000 unless
they
have entered data into cell A9.
I've tried to alter this code to do that...but I had no luck!!


If Target.Cells.Count 1 Then Exit Sub

If Target.Cells(1).Row = 9 _
And Target.Cells(1).Row <= 1000 _
And Target.Cells(1).Column = 5 _
And Target.Cells(1).Column <= 58 Then

If Target.Parent.Cells(7, Target.Cells(1).Column).Value = "" Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox " This column needs a heading!!You must enter a

heading
in cell 7 above. Once the heading is entered into cell 7, you will be

able
to enter data into this column.", vbOKOnly, "Column Label Required in

Cell
&
above"
Target.Parent.Cells(7, Target.Cells(1).Column).Select
End If
End If


Any help is greatly appreicated!!!
Thanks in advance!
Kimberly








All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com