Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Alternative VBA to copy a worksheet

Hi,

I am having some problems with some code I wrote a while back which has, up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Alternative VBA to copy a worksheet

That's the only way. Before should not cause you a problem. Maybe there is
something in the code causing it.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Graham Whitehead" wrote in message
...
Hi,

I am having some problems with some code I wrote a while back which has,
up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Alternative VBA to copy a worksheet

This is an excerpt from VBA help on copying sheets.

If you don't specify either Before or After, Microsoft Excel creates a new
workbook that contains the copied sheet.

So it looks like you have to specify where you want it if you want it in the
same workbook. If you are having problems with that syntax, try using the
sheet name instead of the index number.

"Graham Whitehead" wrote:

Hi,

I am having some problems with some code I wrote a while back which has, up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Alternative VBA to copy a worksheet

If you don't include the Befrroe or After excel puts the new worksheet in a
new wrokbook. I don't think that is what you want.

"Bob Phillips" wrote:

That's the only way. Before should not cause you a problem. Maybe there is
something in the code causing it.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Graham Whitehead" wrote in message
...
Hi,

I am having some problems with some code I wrote a while back which has,
up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Alternative VBA to copy a worksheet

When you look in the VBAProject is there a Sheet1(TabName) or Sheet*(Sheet1).
It could be someone deleted the worksheet you code is referring to.
--
Mike Q.


"Graham Whitehead" wrote:

Hi,

I am having some problems with some code I wrote a while back which has, up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Alternative VBA to copy a worksheet

But he did use Before? And the whole point of the question was to ask if he
could achieve that result some other way.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Joel" wrote in message
...
If you don't include the Befrroe or After excel puts the new worksheet in
a
new wrokbook. I don't think that is what you want.

"Bob Phillips" wrote:

That's the only way. Before should not cause you a problem. Maybe there
is
something in the code causing it.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Graham Whitehead" wrote in message
...
Hi,

I am having some problems with some code I wrote a while back which
has,
up
unitl now, worked fine. The line is:

Sheets("Year to Date").Copy Befo=Sheets(1)

if there a generic way to copy a worksheet and move it to the first
posistion, i.e. the worksheet foremost to the left, without having to
specifiy Befo=Sheets(1) - as I am sure this is causing the problem.

Many thanks







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
Alternative copy/delete method needed KevHardy Excel Discussion (Misc queries) 2 February 11th 10 01:39 PM
Copy-Paste Alternative Needed... Turp Excel Discussion (Misc queries) 1 January 12th 10 07:03 PM
formula copy or alternative solutions Arain Excel Discussion (Misc queries) 5 August 5th 08 05:33 AM
Alternative to Copy and paste values in VBA thisguy[_2_] Excel Programming 9 August 12th 05 05:00 PM
is there a better alternative to Copy/Paste? MichaelC Excel Programming 3 June 9th 05 12:31 AM


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