bturner2
07-07-2004, 11:47 AM
:roll: Ok guys I am back. I have another problem I can?t quit get. This is what I am trying to do.
I want to select cell D7 on sheet1, see if this cell is empty, if it is empty I want it to place a formula in the cell. If it is not empty, I want it to drop down two rows and start this procedure over. And I want it to stop when it has entered the formula until the next time I need to add another formula. I also need it to start a new column of formulas, starting in cell I7 after it has entered a formula in cell D49.
So in short find the first empty cell in column D and enter a formula. Keep filling cells as needed over time untill a formula has been entered in D49 then skip to column I in cell 7 and start entering formulas there as they are needed.
Here is what I have so far. What am I doing wrong?
Sub cant_get_it_right()
MyInput = InputBox("Enter the employees name")
Do
Range("d7").Select
Start:
If ActiveCell.CurrentRegion = ("D49") Then
Range("i7").Select
ElseIf ActiveCell = "" Then
ActiveCell.Formula = "=IF(" & MyInput & "!G2>79,""Discharge"",IF(" & MyInput & "!G2>71,""Final""," & _
"IF(" & MyInput & "!G2>63,""Second"",IF(" & MyInput & "!G2>55,""First""," & _
"IF(" & MyInput & "!G2>31,""Informational"","""")))))"
Exit Sub
Else
ActiveCell.Offset(2, 0).Select
GoTo Start
End If
Loop Until ActiveCell <> ""
End Sub
I want to select cell D7 on sheet1, see if this cell is empty, if it is empty I want it to place a formula in the cell. If it is not empty, I want it to drop down two rows and start this procedure over. And I want it to stop when it has entered the formula until the next time I need to add another formula. I also need it to start a new column of formulas, starting in cell I7 after it has entered a formula in cell D49.
So in short find the first empty cell in column D and enter a formula. Keep filling cells as needed over time untill a formula has been entered in D49 then skip to column I in cell 7 and start entering formulas there as they are needed.
Here is what I have so far. What am I doing wrong?
Sub cant_get_it_right()
MyInput = InputBox("Enter the employees name")
Do
Range("d7").Select
Start:
If ActiveCell.CurrentRegion = ("D49") Then
Range("i7").Select
ElseIf ActiveCell = "" Then
ActiveCell.Formula = "=IF(" & MyInput & "!G2>79,""Discharge"",IF(" & MyInput & "!G2>71,""Final""," & _
"IF(" & MyInput & "!G2>63,""Second"",IF(" & MyInput & "!G2>55,""First""," & _
"IF(" & MyInput & "!G2>31,""Informational"","""")))))"
Exit Sub
Else
ActiveCell.Offset(2, 0).Select
GoTo Start
End If
Loop Until ActiveCell <> ""
End Sub