Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name

I'm adding this line of code to save the current sheet name to retrieve
later. When I enter it, I get an "Compile error, expected list
separator or )" error and it highlights the "s4". I have nearly the
exact same line of code elsewhere in the program and it works fine,
just has a different sheet and cell location.

sheets ("County Records).Range("s4")= ActiveSheet.Name

Any ideas why this is happening here? I'm just trying to save the
sheetname so I can put in a button/macro to return to the source sheet
when I'm done with this one.
Thanks for the help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name

Thanks, Don. I caught the missing quote just after I sent it. But it
still won't store the sheet name in the desired cell. Any ideas?

  #4   Report Post  
Posted to microsoft.public.excel.programming
DJB DJB is offline
external usenet poster
 
Posts: 8
Default Won't accept sheet name

you usually don't have to do this but try:
sheets ("County Records").Range("s4").value = ActiveSheet.Name


"davegb" wrote:

Thanks, Don. I caught the missing quote just after I sent it. But it
still won't store the sheet name in the desired cell. Any ideas?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Won't accept sheet name

What's the sheet name?

Maybe:

sheets("County Records").Range("s4").value = "'" & ActiveSheet.Name

(to force it to be text. I added .value, 'cause I like it!)

davegb wrote:

I'm adding this line of code to save the current sheet name to retrieve
later. When I enter it, I get an "Compile error, expected list
separator or )" error and it highlights the "s4". I have nearly the
exact same line of code elsewhere in the program and it works fine,
just has a different sheet and cell location.

sheets ("County Records).Range("s4")= ActiveSheet.Name

Any ideas why this is happening here? I'm just trying to save the
sheetname so I can put in a button/macro to return to the source sheet
when I'm done with this one.
Thanks for the help.


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name


Dave Peterson wrote:
What's the sheet name?

Maybe:

sheets("County Records").Range("s4").value = "'" & ActiveSheet.Name

(to force it to be text. I added .value, 'cause I like it!)

davegb wrote:

I'm adding this line of code to save the current sheet name to

retrieve
later. When I enter it, I get an "Compile error, expected list
separator or )" error and it highlights the "s4". I have nearly the
exact same line of code elsewhere in the program and it works fine,
just has a different sheet and cell location.

sheets ("County Records).Range("s4")= ActiveSheet.Name

Any ideas why this is happening here? I'm just trying to save the
sheetname so I can put in a button/macro to return to the source

sheet
when I'm done with this one.
Thanks for the help.


--

Dave Peterson


Thanks for the reply, Dave.
I tried adding the ".value" after I posted here. Didn't help either!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Won't accept sheet name

Did you try adding the single quote? (I didn't expect the .value to be the
solution--I just like to explicitly use properties.)

(and you didn't answer my question about the sheetname.)

davegb wrote:

Dave Peterson wrote:
What's the sheet name?

Maybe:

sheets("County Records").Range("s4").value = "'" & ActiveSheet.Name

(to force it to be text. I added .value, 'cause I like it!)

davegb wrote:

I'm adding this line of code to save the current sheet name to

retrieve
later. When I enter it, I get an "Compile error, expected list
separator or )" error and it highlights the "s4". I have nearly the
exact same line of code elsewhere in the program and it works fine,
just has a different sheet and cell location.

sheets ("County Records).Range("s4")= ActiveSheet.Name

Any ideas why this is happening here? I'm just trying to save the
sheetname so I can put in a button/macro to return to the source

sheet
when I'm done with this one.
Thanks for the help.


--

Dave Peterson


Thanks for the reply, Dave.
I tried adding the ".value" after I posted here. Didn't help either!


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name

Dave,
The single quote didn't seem to have any effect. The sheet name is
"County Records". Any other ideas?

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name

Just realized maybe you meant the other sheet name, the one I'm
storing. In this test case, it is "Recurrence".

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default Won't accept sheet name

I figured it out! I was pasting the data from an advanced filter into
the "County Records" sheet after I put the name of the source sheet in
S4. Even though the data was not going into the cell, it was erasing
the entire sheet before the data was pasted, and eraxing the sheet name
in S4 with it. I saved the original sheet name as a variable, then
pasted it into S4 after the clearing and pasting was done.
Thanks for the help!

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
I want a cell should 2 accept only =0 or <=30 or Y or N Brijesh Poojary New Users to Excel 1 April 6th 10 06:45 AM
Accept or Reject a value crabflinger Excel Worksheet Functions 1 April 3rd 09 05:46 PM
Track/Accept Changes WhOkNoWs Excel Worksheet Functions 0 August 22nd 07 02:26 PM
license box accept sherrysue11 Excel Discussion (Misc queries) 0 July 20th 06 02:42 PM
Accept on condition only ! J_J Excel Programming 4 November 6th 04 01:06 PM


All times are GMT +1. The time now is 12:33 AM.

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"