View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default simple code not working

ossie - yes, it generally was the only workbook open & active at the
time of it executing, as it is now.

update:
our computer tech examined the coding & found everything was ok. he
made a copy of the sheet, deleted the original sheet, and renamed the
sheet to it's original name. now it works fine. don't know why!
thanks again
susan


On Apr 1, 11:41*pm, OssieMac
wrote:
If it has worked previously then it was pure chance that ThisWorkbook was the
ActiveWorkbook at the time thecodewas 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 assimpleas


Sheets("Indirect Costs").Select


* * *Range("A1").Select


thiscodebit has beenworkingforever. *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
++++++++++++++++++++++++++++++++++++++


.- Hide quoted text -


- Show quoted text -