Solved

automation error

Posted on 2004-04-03
4
263 Views
Last Modified: 2010-05-02
I am trying to copy cells from one excel sheet to another
The part of the code  is



Application.Dialogs(xlDialogOpen).Show ("D:\Games")
filenam = ActiveWorkbook.Name
:
:
Workbooks("test.xls").Activate
Sheets("Month").Select
Range("B2").Select
If (actdate = 1) And (ActiveCell.Value <> "") Then
Call deletall
End If

Workbooks(filenam).Activate
Sheets("KR").Select
Range("B8").Select---Here the problem occurs
Total_calls = ActiveCell.Value
Workbooks("test.xls").Activate
Sheets("Month").Select
TCRow = "E" + CStr(CInt(actdate) + 1)
Range(TCRow).Select
ActiveCell.Value = Total_calls


At he point shown above I get an error Method select of range class failed followed by Error Message: -2147417848 Automation Error.

Please hlp
0
Comment
Question by:greatmanu
  • 2
  • 2
4 Comments
 

Author Comment

by:greatmanu
Comment Utility
Method 'Select' of  object 'Range' Failed
0
 
LVL 18

Expert Comment

by:Sethi
Comment Utility
Create a Worksheet object and use Range like this:
Set objWorkSheet = objWorkbook.Worksheets(1)
Set objRange = objWorkSheet.Range("B2:B10")
objRange.Select
0
 

Author Comment

by:greatmanu
Comment Utility
can u suggest another simpler workaround cause,the whole thing would make my program too much to handle.Thanks for the help
0
 
LVL 18

Accepted Solution

by:
Sethi earned 125 total points
Comment Utility
I am sorry, I have done it only this way :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now