View Single Post
  #19   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default simple code not working

If it has worked previously then it was pure chance that ThisWorkbook was the
ActiveWorkbook at the time the code was executed. You cannot Activate a
Workbook and Select a Worksheet in the one line. Need to first Activate the
Workbook and then Select the worksheet.

ThisWorkbook.Activate

Worksheets("Indirect Costs").Select

With Worksheets("Indirect Costs")
.Range("a1").Select
End With

--
Regards,

OssieMac


"XR8 Sprintless" wrote:

On 31/03/2010 5:17 AM, Susan wrote:

Could it be as simple as

Sheets("Indirect Costs").Select

Range("A1").Select



this code bit has been working forever. recently had a virus& had to
reinstall microsoft office 07. now it won't work. i'm assuming
there's some wording difference it's looking for - can anybody help me
out?
thanks.
susan
++++++++++++++++++++++++++++++++++++++
ThisWorkbook.Worksheets("Indirect Costs").Select

With Worksheets("Indirect Costs")
.Range("a1").Select
End With
++++++++++++++++++++++++++++++++++++++
i also tried the following which stops on "Activate":

With ThisWorkbook
With Worksheets("Indirect Costs")
.Activate
.Range("a1").Select
End With
End With
++++++++++++++++++++++++++++++++++++++


.