VBA help needed

G

Geert

I have a sheet in which i can insert a new row with data through a user
form. After I fill in the user form I get a new row with the data from the
user form. Now I would like to insert two extra empty rows (witch I can
fill in myself) with the user form action with in the second cel of the
extra rows a text like A in the first extra row and B in the second extra
row.

Is that possible?? Under is a part of the code where the action in is (I
think). If wanted I can post the complete code of this action.



Sub autotiming()
Application.ScreenUpdating = False
Dim Msg, Style, Title, Response
Dim tk As Variant
Dim ph As Variant

If Range("keyflag").Value = 0 Then

protection.Unprotectit


If Range("startdate").Value < Now - Time Then
Title = "Start Date occurs in the past"
Style = vbYesNo
Msg = "The project start date '" & Range("startdate").Text &
"' specified in the Resources sheet occurs in the past." &
Chr(10) & Chr(10)
Msg = Msg & "Would you like to update it to todays date?"
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then
Range("startdate").Value = Now - Time
End If
End If

Application.StatusBar = "Clearing previous auto-timing"

Call clear_autotiming

Application.ScreenUpdating = False
protection.Unprotectit

Application.StatusBar = "Running Auto-timing..."

For Each tk In Range(Range("start_task").Offset(1, 0),
Range("ins_task").Offset(-1, 0))
If tk.Offset(0, 13).Text <> "" And tk.Offset(0, 17).Text = ""
Then
tk.Offset(0, 14).Value = finishdate(tk.Offset(0,
13).Value, tk.Offset(0, 10).Text, tk.Offset(0, 11).Value,
tk.Offset(0, 12).Value, tk.Row)
End If
Next

For Each ph In Range("phases")
For Each tk In Range(Range("start_task").Offset(1, 0),
Range("ins_task").Offset(-1, 0))
If tk.Offset(0, 1).Text = ph And tk.Offset(0, 3).Text = ""
And tk.Offset(0, 17).Text = "" And tk.Offset(0, 25).Text =
"" Then
tk.Offset(0, 13).Value = startdate(tk.Row)
tk.Offset(0, 14).Value = finishdate(tk.Offset(0,
13).Value, tk.Offset(0, 10).Text, tk.Offset(0,
11).Value, tk.Offset(0, 12).Value, tk.Row)
End If
Next
For Each tk In Range(Range("start_task").Offset(1, 0),
Range("ins_task").Offset(-1, 0))
If tk.Offset(0, 1).Text = ph And tk.Offset(0, 3).Text <>
"" And tk.Offset(0, 17).Text = "" And tk.Offset(0,
25).Text = "" Then
tk.Offset(0, 13).Value = startdate(tk.Row)
tk.Offset(0, 14).Value = finishdate(tk.Offset(0,
13).Value, tk.Offset(0, 10).Text, tk.Offset(0,
11).Value, tk.Offset(0, 12).Value, tk.Row)
End If
Next
Next

For Each tk In Range(Range("start_task").Offset(1, 0),
Range("ins_task").Offset(-1, 0))
If tk.Offset(0, 13).Text <> "" And tk.Offset(0, 17).Text <> ""
Then
tk.Offset(0, 27).Formula = tk.Offset(0, 13).Value
tk.Offset(0, 28).Formula = tk.Offset(0, 12).Value
tk.Offset(0, 29).Formula = tk.Offset(0, 17).Value
tk.Offset(0, 30).Formula = tk.Offset(0, 12).Value
End If
Next

Range("O5").Select

Application.StatusBar = "Ready"

Application.ScreenUpdating = False
protection.Protectit

Else
Style = vbCritical
Title = "Trial Period Expired"
Msg = "The trial period for this application has expired." & Chr(10) &
Chr(10)
Msg = Msg & "This program cannot be executed until a valid
registration key is entered on opening this workbook."
Response = MsgBox(Msg, Style, Title)
End If
Application.ScreenUpdating = True
End Sub
 
Top