Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default simple code not working

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
++++++++++++++++++++++++++++++++++++++
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default simple code not working

Add a dot

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

--

HTH

Bob

"Susan" wrote in message
...
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
++++++++++++++++++++++++++++++++++++++



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default simple code not working

I'd use a variation of Don's code:

sub gothere()
application.goto Thisworkbook.worksheets("Indirect Costs").Range("a1")
end sub

And this variation of Bob's code:

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

I was kind of surprised that Bob's code (without the workbook activate
statement) worked if ThisWorkbook wasn't the activeworkbook.


Susan wrote:

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
++++++++++++++++++++++++++++++++++++++


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 834
Default simple code not working

Not really my code Dave, all I did was add a single dot <bg

--

HTH

Bob

"Dave Peterson" wrote in message
...
I'd use a variation of Don's code:

sub gothere()
application.goto Thisworkbook.worksheets("Indirect Costs").Range("a1")
end sub

And this variation of Bob's code:

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

I was kind of surprised that Bob's code (without the workbook activate
statement) worked if ThisWorkbook wasn't the activeworkbook.


Susan wrote:

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
++++++++++++++++++++++++++++++++++++++


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default simple code not working

Bob, it's all community code and that makes it yours!

I've always activated the workbook before selecting/activating a sheet in that
workbook. I wonder if that's required in all versions--or just a requirement of
the version that I first learned excel (xl95/xl97???).



Bob Phillips wrote:

Not really my code Dave, all I did was add a single dot <bg

--

HTH

Bob

"Dave Peterson" wrote in message
...
I'd use a variation of Don's code:

sub gothere()
application.goto Thisworkbook.worksheets("Indirect Costs").Range("a1")
end sub

And this variation of Bob's code:

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

I was kind of surprised that Bob's code (without the workbook activate
statement) worked if ThisWorkbook wasn't the activeworkbook.


Susan wrote:

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
++++++++++++++++++++++++++++++++++++++


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default simple code not working

On 3/30/2010 3:17 PM, Susan wrote:
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
++++++++++++++++++++++++++++++++++++++


Just another way.
This requires you to add ' around the tab name because the name has a
space in it

Application.Goto Range("'Indirect Costs'!A1")

= = = = = = =
HTH :)
Dana DeLouis
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default simple code not working

I wouldn't use this syntax.

Application.Goto Range("'Indirect Costs'!A1")

Depending on where the code is located (like a sheet module), it may not work.



Dana DeLouis wrote:

On 3/30/2010 3:17 PM, Susan wrote:
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
++++++++++++++++++++++++++++++++++++++


Just another way.
This requires you to add ' around the tab name because the name has a
space in it

Application.Goto Range("'Indirect Costs'!A1")

= = = = = = =
HTH :)
Dana DeLouis


--

Dave Peterson
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default simple code not working

i tried bob's first because it was closest to my own, but it still
breaks on "activate" with "application-defined or object-defined
error".

then i tried dave's variation on bob's code, but it still breaks on
the 2nd "activate" with the same error. i have stared at the coding &
the name of the page till i am blue in the face & i am sure they are
identical.

then i tried the application.goto codes & they also failed with the
same error. the name of the sheet has NOT changed. the original
coding did NOT change. just one day i opened it up & it didn't work,
& now it still won't. any way to verify the sheet name in the
immediate window?

thanks for all your help
susan


On Mar 30, 3:10*pm, "Bob Phillips" wrote:
Add a dot

With ThisWorkbook
* * *With .Worksheets("Indirect Costs")
* * * * * .Activate
* * * * * .Range("A1").Select
* * *End With
End With

--

HTH

Bob

"Susan" wrote in message

...



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
++++++++++++++++++++++++++++++++++++++- Hide quoted text -


- Show quoted text -


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default simple code not working

more info. i looked in the project properties & found that the
"Indirect Costs" sheet was sheet 4. so i changed the application.goto
coding to Worksheets(4).range("a1").select. and it selected the wrong
sheet. so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. tried it with several other of the worksheets & got
additionally wrong information.

i think my virus is not gone after all.

susan


On Mar 31, 7:06*am, Susan wrote:
i tried bob's first because it was closest to my own, but it still
breaks on "activate" with "application-defined or object-defined
error".

then i tried dave's variation on bob's code, but it still breaks on
the 2nd "activate" with the same error. *i have stared at the coding &
the name of the page till i am blue in the face & i am sure they are
identical.

then i tried the application.goto codes & they also failed with the
same error. *the name of the sheet has NOT changed. *the original
coding did NOT change. *just one day i opened it up & it didn't work,
& now it still won't. *any way to verify the sheet name in the
immediate window?

thanks for all your help
susan

On Mar 30, 3:10*pm, "Bob Phillips" wrote:



Add a dot


With ThisWorkbook
* * *With .Worksheets("Indirect Costs")
* * * * * .Activate
* * * * * .Range("A1").Select
* * *End With
End With


--


HTH


Bob


"Susan" wrote in message


....


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
++++++++++++++++++++++++++++++++++++++- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default simple code not working


The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:

ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With

always assuming your sheet is visible...


Susan;686641 Wrote:

more info. i looked in the project properties & found that the
"Indirect Costs" sheet was sheet 4. so i changed the application.goto
coding to Worksheets(4).range("a1").select. and it selected the wrong
sheet. so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. tried it with several other of the worksheets & got
additionally wrong information.

i think my virus is not gone after all.

susan



--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default simple code not working

Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")

Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.

ThisWorkbook.Activate
With Sheet4
.Activate
.Range("A1").Select
End With

errors out on "With Sheet4". worksheet is visible. this error is
occurring on all worksheets even back 2 years. it is the same
worksheet that gets saved month-to-month. code has not changed.
sheet name has not changed. i'm perplexed.
susan

On Mar 31, 8:09*am, aflatoon wrote:
The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:

ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With

always assuming your sheet is visible...

Susan;686641 Wrote:

more info. *i looked in the project properties & found that the

"Indirect Costs" sheet was sheet 4. *so i changed the application.goto
coding to Worksheets(4).range("a1").select. *and it selected the wrong
sheet. *so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. *tried it with several other of the worksheets & got
additionally wrong information.


i think my virus is not gone after all.


susan


--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default simple code not working

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Susan" wrote in message
...
Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")

Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.

ThisWorkbook.Activate
With Sheet4
.Activate
.Range("A1").Select
End With

errors out on "With Sheet4". worksheet is visible. this error is
occurring on all worksheets even back 2 years. it is the same
worksheet that gets saved month-to-month. code has not changed.
sheet name has not changed. i'm perplexed.
susan

On Mar 31, 8:09�am, aflatoon wrote:
The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:

ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With

always assuming your sheet is visible...

Susan;686641 Wrote:

more info. �i looked in the project properties & found that the

"Indirect Costs" sheet was sheet 4. �so i changed the application.goto
coding to Worksheets(4).range("a1").select. �and it selected the wrong
sheet. �so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. �tried it with several other of the worksheets & got
additionally wrong information.


i think my virus is not gone after all.


susan


--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz


  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default simple code not working


Very strange. Have you tried running Code Cleaner on it to see if that
helps?
Does a simple


Code:
--------------------


msgbox Sheet4.Name
--------------------



work?


Susan;686739 Wrote:

Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")

Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.

ThisWorkbook.Activate
With Sheet4
.Activate
.Range("A1").Select
End With

errors out on "With Sheet4". worksheet is visible. this error is
occurring on all worksheets even back 2 years. it is the same
worksheet that gets saved month-to-month. code has not changed.
sheet name has not changed. i'm perplexed.
susan




--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default simple code not working

Application.Goto Sheet4.Range("a1")



Susan wrote:

Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")

Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.

ThisWorkbook.Activate
With Sheet4
.Activate
.Range("A1").Select
End With

errors out on "With Sheet4". worksheet is visible. this error is
occurring on all worksheets even back 2 years. it is the same
worksheet that gets saved month-to-month. code has not changed.
sheet name has not changed. i'm perplexed.
susan

On Mar 31, 8:09 am, aflatoon wrote:
The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:

ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With

always assuming your sheet is visible...

Susan;686641 Wrote:

more info. i looked in the project properties & found that the

"Indirect Costs" sheet was sheet 4. so i changed the application.goto
coding to Worksheets(4).range("a1").select. and it selected the wrong
sheet. so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. tried it with several other of the worksheets & got
additionally wrong information.


i think my virus is not gone after all.


susan


--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz


--

Dave Peterson


  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default simple code not working

ps. If using the codename works, then I'd bet big money that the worksheet name
(that the user sees on the tab) was changed.

Maybe an extra space (leading/trailing/embedded????) or even a typo.



Dave Peterson wrote:

Application.Goto Sheet4.Range("a1")

Susan wrote:

Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")

Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.

ThisWorkbook.Activate
With Sheet4
.Activate
.Range("A1").Select
End With

errors out on "With Sheet4". worksheet is visible. this error is
occurring on all worksheets even back 2 years. it is the same
worksheet that gets saved month-to-month. code has not changed.
sheet name has not changed. i'm perplexed.
susan

On Mar 31, 8:09 am, aflatoon wrote:
The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:

ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With

always assuming your sheet is visible...

Susan;686641 Wrote:

more info. i looked in the project properties & found that the

"Indirect Costs" sheet was sheet 4. so i changed the application.goto
coding to Worksheets(4).range("a1").select. and it selected the wrong
sheet. so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. tried it with several other of the worksheets & got
additionally wrong information.

i think my virus is not gone after all.

susan

--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=191759

http://www.thecodecage.com/forumz


--

Dave Peterson


--

Dave Peterson
  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default simple code not working

sigh. nope, nothing works. i even rearranged how the macro works
(because i wrote it 2 years ago as a beginner) & it still doesn't
work. i think i'm going to have to send it to don. i don't have code
cleaner on my computer anymore since the virus but i can get it again.
i appreciate the help from everybody!
:)
susan


On Mar 31, 9:51*am, Dave Peterson wrote:
ps. *If using the codename works, then I'd bet big money that the worksheet name
(that the user sees on the tab) was changed.

Maybe an extra space (leading/trailing/embedded????) or even a typo.





Dave Peterson wrote:

Application.Goto Sheet4.Range("a1")


Susan wrote:


Application.Goto ThisWorkbook.Worksheets(Sheet4).Range("a1")


Sheet4 = ("Indirect Costs") in the properties window where it says
"Microsoft Excel Objects".
get same error.


ThisWorkbook.Activate
*With Sheet4
*.Activate
*.Range("A1").Select
*End With


errors out on "With Sheet4". *worksheet is visible. *this error is
occurring on all worksheets even back 2 years. *it is the same
worksheet that gets saved month-to-month. *code has not changed.
sheet name has not changed. *i'm perplexed.
susan


On Mar 31, 8:09 am, aflatoon wrote:
The index number of the worksheet (the 4 in Worksheets(4)) is the
number of sheets counting from the left of the tab order. It has no
relation to the code name. If the code name is sheet4, then you should
be able to use:


ThisWorkbook.Activate
with Sheet4
.Activate
.Range("A1").select
End With


always assuming your sheet is visible...


Susan;686641 Wrote:


more info. *i looked in the project properties & found that the


"Indirect Costs" sheet was sheet 4. *so i changed the application.goto
coding to Worksheets(4).range("a1").select. *and it selected the wrong
sheet. *so in the immediate window i typed ?
ThisWorkbook.Worksheets(4).name & got a different name than the one i
expected. *tried it with several other of the worksheets & got
additionally wrong information.


i think my virus is not gone after all.


susan


--
aflatoon


Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: 1501
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=191759


http://www.thecodecage.com/forumz


--


Dave Peterson


--

Dave Peterson- Hide quoted text -

- Show quoted text -


  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default simple code not working

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
++++++++++++++++++++++++++++++++++++++


  #19   Report Post  
Posted to microsoft.public.excel.programming
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
++++++++++++++++++++++++++++++++++++++


.

  #20   Report Post  
Posted to microsoft.public.excel.programming
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 -


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
Simple VBA Code Working in Excel 2007 but not Excel 2003 #N/A KMH Excel Programming 1 March 3rd 10 09:25 AM
Simple VBA Code written in Excel 2003 not working in Excel 2000 Rich B. Excel Programming 4 August 3rd 07 04:36 PM
Simple VBA code not working on new laptop Alex Excel Programming 6 June 14th 07 03:03 PM
This should be so simple but it's not working, please help tahrah Excel Programming 4 January 16th 07 12:11 AM
This should be simple but it's not working for me! hellokitty New Users to Excel 4 April 12th 05 01:26 AM


All times are GMT +1. The time now is 09:32 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"