Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why does copy after worksheets command not work on some computers

I have written a VBA macro for an Excel 2003 workbook. Amongst other things,
at the end of the month it is intended to copy the most recent monthly sheet
and add it as a fresh copy as the new month's sheet for editing.

The weird thing is that, although this works fine on my laptop and most
other computers I have tried it on, it will not work on my desktop computer,
even if I copy exactly the same file across from one to the other.

Grateful for any pointers

Thx

Ian


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Why does copy after worksheets command not work on some computers

Hi Ian,

I think that you would need to post the relevant portion of your code.

You should also explain what you mean by:

it will not work on my desktop computer.


Does the code produce an error or merely not perform as you expect?


---
Regards,
Norman



"IanRC" wrote in message
...
I have written a VBA macro for an Excel 2003 workbook. Amongst other
things,
at the end of the month it is intended to copy the most recent monthly
sheet
and add it as a fresh copy as the new month's sheet for editing.

The weird thing is that, although this works fine on my laptop and most
other computers I have tried it on, it will not work on my desktop
computer,
even if I copy exactly the same file across from one to the other.

Grateful for any pointers

Thx

Ian




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why does copy after worksheets command not work on some comput

Norman

Thanks. The relevant code is as follows:

' Add new sheet and title as next month
SPosition = Sheets.Count
.....
Sheets(SPosition).Select
Sheets(SPosition).Copy After:=Sheets(SPosition) 'adds a new sheet

On my laptop this last line inserts the a copy of the last sheet in the
spreadsheet after the sheet that was previously the last sheet. On my
desktop the macro just stops executing and exits at this point without
inserting the new sheet.

Sorry I was not clearer before

Ian



"Norman Jones" wrote:

Hi Ian,

I think that you would need to post the relevant portion of your code.

You should also explain what you mean by:

it will not work on my desktop computer.


Does the code produce an error or merely not perform as you expect?


---
Regards,
Norman



"IanRC" wrote in message
...
I have written a VBA macro for an Excel 2003 workbook. Amongst other
things,
at the end of the month it is intended to copy the most recent monthly
sheet
and add it as a fresh copy as the new month's sheet for editing.

The weird thing is that, although this works fine on my laptop and most
other computers I have tried it on, it will not work on my desktop
computer,
even if I copy exactly the same file across from one to the other.

Grateful for any pointers

Thx

Ian





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Why does copy after worksheets command not work on some comput

Hi Ian,

SPosition = Sheets.Count
.....
Sheets(SPosition).Select
Sheets(SPosition).Copy After:=Sheets(SPosition) 'adds a new
sheet


Since you do not qualify any instance of Sheets, the code will be qualified
implicitly to relate to the active workbook. It may be that the active
workbook is not the required workbook, in which case a sheet is being added
to the wrong workbook.

Try, therefore, qualifying the above code with a named workbook, or a
variable set to the workbook.

If the workbook of interest is the active workbook, I can see no reason for
the shown code to fail to add the new sheet.


---
Regards,
Norman



"IanRC" wrote in message
...
Norman

Thanks. The relevant code is as follows:

' Add new sheet and title as next month
SPosition = Sheets.Count
.....
Sheets(SPosition).Select
Sheets(SPosition).Copy After:=Sheets(SPosition) 'adds a new
sheet

On my laptop this last line inserts the a copy of the last sheet in the
spreadsheet after the sheet that was previously the last sheet. On my
desktop the macro just stops executing and exits at this point without
inserting the new sheet.

Sorry I was not clearer before

Ian



"Norman Jones" wrote:

Hi Ian,

I think that you would need to post the relevant portion of your code.

You should also explain what you mean by:

it will not work on my desktop computer.


Does the code produce an error or merely not perform as you expect?


---
Regards,
Norman



"IanRC" wrote in message
...
I have written a VBA macro for an Excel 2003 workbook. Amongst other
things,
at the end of the month it is intended to copy the most recent monthly
sheet
and add it as a fresh copy as the new month's sheet for editing.

The weird thing is that, although this works fine on my laptop and most
other computers I have tried it on, it will not work on my desktop
computer,
even if I copy exactly the same file across from one to the other.

Grateful for any pointers

Thx

Ian







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Why does copy after worksheets command not work on some comput

Thanks Norman

Tried that but no luck. The strange thing is it works fine on my laptop,
just not on my desktop

Ian

"Norman Jones" wrote:

Hi Ian,

SPosition = Sheets.Count
.....
Sheets(SPosition).Select
Sheets(SPosition).Copy After:=Sheets(SPosition) 'adds a new
sheet


Since you do not qualify any instance of Sheets, the code will be qualified
implicitly to relate to the active workbook. It may be that the active
workbook is not the required workbook, in which case a sheet is being added
to the wrong workbook.

Try, therefore, qualifying the above code with a named workbook, or a
variable set to the workbook.

If the workbook of interest is the active workbook, I can see no reason for
the shown code to fail to add the new sheet.


---
Regards,
Norman



"IanRC" wrote in message
...
Norman

Thanks. The relevant code is as follows:

' Add new sheet and title as next month
SPosition = Sheets.Count
.....
Sheets(SPosition).Select
Sheets(SPosition).Copy After:=Sheets(SPosition) 'adds a new
sheet

On my laptop this last line inserts the a copy of the last sheet in the
spreadsheet after the sheet that was previously the last sheet. On my
desktop the macro just stops executing and exits at this point without
inserting the new sheet.

Sorry I was not clearer before

Ian



"Norman Jones" wrote:

Hi Ian,

I think that you would need to post the relevant portion of your code.

You should also explain what you mean by:

it will not work on my desktop computer.

Does the code produce an error or merely not perform as you expect?


---
Regards,
Norman



"IanRC" wrote in message
...
I have written a VBA macro for an Excel 2003 workbook. Amongst other
things,
at the end of the month it is intended to copy the most recent monthly
sheet
and add it as a fresh copy as the new month's sheet for editing.

The weird thing is that, although this works fine on my laptop and most
other computers I have tried it on, it will not work on my desktop
computer,
even if I copy exactly the same file across from one to the other.

Grateful for any pointers

Thx

Ian










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
Copy worksheet into several worksheets in the same or another work lawrencae New Users to Excel 4 January 8th 08 01:15 PM
Copy worksheet into several worksheets in the same or another work lawrencae Excel Discussion (Misc queries) 2 January 7th 08 02:54 PM
How can I link excel spreadsheets that work on other computers Bob Excel Discussion (Misc queries) 1 May 16th 05 06:33 AM
Copy Worksheets Error #1004 Work Around Jim Wiley Excel Programming 1 May 14th 05 10:38 AM
Formula won't work on some computers Steph[_3_] Excel Programming 2 March 3rd 05 06:08 PM


All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"