Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Error while moving sheet

Hello;
I'm getting Run-time error '9': Subscript out of range
with this code on line with *.
Dim FName As String
FName = BP & "-" & EP & ".xls"
Path = "C:\TS\"
If Not FileExists(FName) Then
ActiveWorkbook.SaveAs FileName:=Path & FName, _
FileFormat:=xlNormal, Password:="++++", WriteResPassword:="++++"
ActiveWorkbook.Close
Else
Workbooks.Open FileName:=Path & FName, Password:="++++",
WriteResPassword:="++++"
ActiveWindow.ActivateNext

* Sheets(1).Move After:=Workbooks(" & FName & ").Sheets(Sheets.Count)

ActiveWorkbook.Close (True)
End If

When I enter actual file name it is fine.
PLease help,
Irek


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Error while moving sheet


Irek
where do you have BP and EP dim'd and there strings set?
i am thinking the BP and EP strings are not passing to this module

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Error while moving sheet

This is not the whole sub, and BP and EP do recalculate correctly
in Immediate window I see
? FName
Aug,01-Aug,15.xls

"stevebriz" wrote in message
ups.com...

Irek
where do you have BP and EP dim'd and there strings set?
i am thinking the BP and EP strings are not passing to this module



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Error while moving sheet


Hello wrote:
This is not the whole sub, and BP and EP do recalculate correctly
in Immediate window I see
? FName
Aug,01-Aug,15.xls

"stevebriz" wrote in message
ups.com...

Irek
where do you have BP and EP dim'd and there strings set?
i am thinking the BP and EP strings are not passing to this module

if you remove the ".xls" from Fname does it open ok?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Error while moving sheet


"stevebriz" wrote in message
oups.com...

Hello wrote:
This is not the whole sub, and BP and EP do recalculate correctly
in Immediate window I see
? FName
Aug,01-Aug,15.xls

"stevebriz" wrote in message
ups.com...

Irek
where do you have BP and EP dim'd and there strings set?
i am thinking the BP and EP strings are not passing to this module

if you remove the ".xls" from Fname does it open ok?


Thx Steve
This is from the macro recorder:
Sheets("Jolanta").Move After:=Workbooks("Aug,01-Aug,15.xls").Sheets(1)

so .xls should be fine. Need to dig up dipper.
Irek




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Error while moving sheet



try this
Sheets(1).Move After:=Workbooks(FName).Sheets(Sheets.Count)

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
formula for moving information from one sheet to another sheet Puzzled Excel Discussion (Misc queries) 4 June 6th 10 05:58 AM
moving from one sheet to another from a cell of a sheet mah1608 Excel Worksheet Functions 1 May 8th 09 06:27 AM
moving informatiion from one sheet to a total sheet john Excel Discussion (Misc queries) 2 January 31st 08 10:17 PM
Error when moving sheet mihai[_6_] Excel Programming 0 November 9th 04 04:33 PM
Error when moving sheet mihai[_5_] Excel Programming 2 November 9th 04 03:14 PM


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