#1   Report Post  
Posted to microsoft.public.excel.misc
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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Named range error Antman Excel Discussion (Misc queries) 3 July 13th 06 02:33 AM
Error 0x800A03EC trying to set range value mdengler New Users to Excel 2 March 1st 06 01:22 PM
out of range error Matilda New Users to Excel 9 September 18th 05 12:11 AM
Subscript out of range error moglione1 Excel Discussion (Misc queries) 2 August 30th 05 01:21 PM
Validation error: Says range not found and it is there? JMike Excel Discussion (Misc queries) 1 February 11th 05 06:35 PM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"