Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Range error
try this modification. I think the problem is with Range("a2" should of been
With Worksheets("Database").Range("a2") Using the WITH makes it easier to code. With Worksheets("Database") .Range("e2", .Range("a2").End(xlDown)). _ Offset(0, 4).FillDown End With "Jennifer" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Named range error | Excel Discussion (Misc queries) | |||
Error 0x800A03EC trying to set range value | New Users to Excel | |||
out of range error | New Users to Excel | |||
Subscript out of range error | Excel Discussion (Misc queries) | |||
Validation error: Says range not found and it is there? | Excel Discussion (Misc queries) |