Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Coping Contents of one Sheet into Another Workbook

I have a need to build a Macro that will take an excel file (Which the
user specifies) and copies the contents of the second sheet (With a
specific name) into another workbook putting specific cells in specific
places in the second workbook. Then I need it to rename the file so we
know that the file has been input.

I'm not even sure where to start, I'm sure I can get the pieces for the
copying and pasting, but how to handle the file and such is going to be
a bit more difficult for me.

Can anyone lend a hand in leading me in the right direction?

TIA
J.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Coping Contents of one Sheet into Another Workbook

Hi
Try the following routines.

Function OpenWorkbook(ByRef wb As Workbook) As Boolean

Dim v As Variant

On Error GoTo OpenWorkbookError
v = Application.GetOpenFilename(FileFilter:="(*.xls),* .xls")
If TypeName(v) = "Boolean" Then
'User Cancelled
GoTo OpenWorkbookError
Else
Set wb = Application.Workbooks.Open(v)
End If
OpenWorkbook = True

Exit Function
OpenWorkbookError:
OpenWorkbook = False

End Function

Function CopyWorkbook()
Dim wb As Workbook
Dim wbNew As Workbook
Dim wsNew As Worksheet

If OpenWorkbook(wb) Then
'do something
Set wbNew = Workbooks.Add
'The worksheet you want to copy will replace
'abc below.
wb.Worksheets("abc").Copy Befo=wbNew.Worksheets(1)
Set wsNew = ActiveSheet

'To copy specific cells to the new worksheet created
'in the new workbook(now called wsNew) you do the following
wsNew.Cells(1, 1).Value = wb.Worksheets("pqr").Cells(1, 1).Value

'do other processing
wbNew.Close SaveChanges:=True
wb.Close SaveChanges:=True
End If
End Function

Alok

"Egon" wrote:

I have a need to build a Macro that will take an excel file (Which the
user specifies) and copies the contents of the second sheet (With a
specific name) into another workbook putting specific cells in specific
places in the second workbook. Then I need it to rename the file so we
know that the file has been input.

I'm not even sure where to start, I'm sure I can get the pieces for the
copying and pasting, but how to handle the file and such is going to be
a bit more difficult for me.

Can anyone lend a hand in leading me in the right direction?

TIA
J.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Coping Contents of one Sheet into Another Workbook

I think I get part of what you are doing here, the only problem is that
the form was created by someone else (The excel worksheet that I'm
copying FROM) and I don't want the format of the cells, I just need the
data IN the cells. But I think I can get that if I can get it opened
and Closed.

Let me try this and see how it goes.

Thanks a ton.
J

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
WHY DOES COPING FROM SHEET TO SHEET INCREASE SIZE DRAMATICALLY? Jerry Excel Discussion (Misc queries) 0 June 1st 07 05:06 PM
Returning contents of a cell in another sheet in same workbook Annette[_2_] Excel Discussion (Misc queries) 1 March 14th 07 04:04 PM
Table of Contents Sheet in Workbook Solusvir Links and Linking in Excel 1 August 31st 06 09:47 AM
Find Cell Contents on Another Sheet in Workbook Jana[_3_] Excel Programming 5 September 22nd 05 08:38 PM
Coping a sheet James Excel Programming 2 April 7th 04 06:26 PM


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