Thread: Range error
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jennifer Jennifer is offline
external usenet poster
 
Posts: 385
Default Range error

I am wanting this to run while on one worksheet while information is on
another worksheet.

Form works until it gets to the
'fill down formula
where is says object failed_worksheet

I could use some help. Thank you!

Private Sub cmdEmpOK_Click()
Dim lastrow As Long
Dim ws As Worksheet
Set ws = Worksheets("Database")

'Finds the last row in the range and drops down 1 below
lastrow = Worksheets("Database").Range("database").End(xlDow n).Row + 1

'Fills the cells with values from text boxes
ws.Cells(lastrow, 1).Value = txtEmpName.Value
ws.Cells(lastrow, 2).Value = txtEmpPosition.Value
ws.Cells(lastrow, 3).Value = Calendar1.Value
ws.Cells(lastrow, 4).Value = txtSalary.Value

'Fills down the formula

Worksheets("Database").Range("e2", Range("a2").End(xlDown)).Offset(0,
4).FillDown

'Worksheets("GwrStmts").Range("GwrStmt").Copy ws.Cells(iRow, 1)
'Clears form
Call UserForm_Initialize
End Sub
--
Thank you,

Jennifer