LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copy sheet from one workbook to another workbook problem

You are welcome

--
Regards Ron de Bruin
http://www.rondebruin.nl


"VJ" wrote in message ...
It works Ron.

Thanks alot and regards,

VJ

"Ron de Bruin" wrote:

Try this basic example
I don't use your code because it is not easy to test for me

I use Book1.xls and Book2.xls and a sheet named "Sheet1"

Sub test()
With Workbooks("Book1.xls").Sheets("Sheet1")
.Cells.Replace What:="=", Replacement:=" =", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

.Cells.Copy Workbooks("Book2.xls").Sheets("Sheet1").Range("A1" )

.Cells.Replace What:=" =", Replacement:="=", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End With

With Workbooks("Book2.xls").Sheets("Sheet1")
.Cells.Replace What:=" =", Replacement:="=", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End With

End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"VJ" wrote in message ...
Hi Ron,

Following is my code which basically copy from one workbook to another

***********Code Starts*******************
'Get the name of the destination workbook.
str_Destination_WBName = ActiveWorkbook.Name
'Activate the Destination workbook.
Windows(str_Destination_WBName).Activate
'Activate the Destination worksheet

Workbooks(str_Destination_WBName).SheetsCOPY_SHEET _NAME).Activate
'Delete all the shapes in the destination worksheet
DeleteAllShapes
'Select all the cells and unmerge them for formatting.
Cells.Select
Selection.UnMerge
'Activate the source copy worksheet as well as select and copy
all the cells.
Workbooks(str_Source_WBName).Sheets(COPY_SHEET_NAM E).Activate
Cells.Select
Selection.Copy
'Activate the Destination workbook.
Windows(str_Destination_WBName).Activate
'Activate the destination worksheet paste the contents from the
source sheet.
Workbooks(str_Destination_WBName).Sheets(COPY_SHEE T_NAME).Activate
ActiveSheet.Paste
Range("A1").Select
'Close the activeworkbook
ActiveWorkbook.Close savechanges:=True

******************Code Ends********************
Pls help me out.

Thanks Ron


"Ron de Bruin" wrote:

Hi VJ

You can do this

Select all cells
Use replace "=" to " =" (see the space before =)
Without quotes

Copy the sheet

And in the new workbook
Use replace " =" to "=" Without quotes

If you need help to do this in code post your macro
and I will try to help you


--
Regards Ron de Bruin
http://www.rondebruin.nl


"VJ" wrote in message ...
I am copying a sheet from one workbook (wb1) to another workbook(wb2) through
a VBA macro.

I can copy the sheet but there is one problem in copying process. After
copying I can see the following code in my cell.

=+'[wb1.xls]Sheet2'!C11

Is there any way to get rid of '[wb1.xls]' portion which is name of the
workbook? I need to keep Sheet2 but dont want to keep the name of the
workbook.

Help would really be appreciated.

Thanks and rgds,











 
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 sheet cells into differnt workbook/sheet, How? IVLUTA Excel Discussion (Misc queries) 2 June 2nd 09 11:16 PM
Copy sheet to different workbook 3Nails Excel Discussion (Misc queries) 2 November 6th 08 03:05 PM
Copy sheet to different workbook 3Nails Excel Discussion (Misc queries) 1 November 5th 08 07:28 PM
How To Copy a Sheet to Another workbook Mpho[_2_] Excel Programming 2 December 8th 03 10:27 AM
How To Copy a Sheet to Another workbook Mpho[_2_] Excel Programming 0 December 8th 03 09:30 AM


All times are GMT +1. The time now is 04:21 PM.

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"