LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default find existing worsheet

hi...

I am writing a code using VBA....`Everytime i click the button its first
copies a worksheet from a workbook "X" to workbook "Y". Based on this
worksheet i make another 2 worksheets in workbook "Y". I want that when i
copy my worksheet...it should check whether the worksheet with a name "RAW"
already exits or not ... if exists then it should replace it. right now it
makes a copy by the name raw (2)???
here is my code for r that part:

BookPath = "G:\11 RFC\+06 FY 03_04\++04 Jan04\TCR\"
BookName = "abc_Jan04.xls"
OpenWorkBook

Sheets("Raw_Data").Select
Sheets("Raw_Data").Copy Befo=Workbooks("best.xls").Sheets(1)
filename = Dir("G:\11 RFC\+06 FY 03_04\++04 Jan04\TCR\abc_Jan04.xls")
....
..


Sub OpenWorkBook()
On Error Resume Next
Err.Clear
Windows(BookName).Activate
If Err.Number < 0 Then
Err.Clear
Workbooks.Open filename:=BookPath & BookName
If Err.Number < 0 Then
Err.Clear
MsgBox ("Unable to locate " & BookName)
End If
End If

pls suggest what change i need to do?

thanks
monika


 
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
Find macro for already existing graph Mike Excel Discussion (Misc queries) 2 May 16th 07 04:27 PM
worsheet evelyne Excel Discussion (Misc queries) 2 April 13th 07 11:29 PM
to find change and paste existing values/rows in excel with help of form Claudia Excel Discussion (Misc queries) 1 August 10th 06 03:03 PM
Despite data existing in Excel 2002 spreadsheet Find doesn't find AnnieB Excel Discussion (Misc queries) 1 June 16th 06 02:15 AM
How do I find out how many different cell formats an existing wor. wheelsii Excel Discussion (Misc queries) 1 March 24th 05 04:58 PM


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