Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Macro to copy a one worksheet in one book to the current workbook

Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to update
the worksheet on if a client calls back. The other workbook will always be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Macro to copy a one worksheet in one book to the current workbook

If I were doing it, I would not use the name ThisWorkbook because that is a
reserved name for Excel workbooks. Using reserved names can cause problems
when running code, because the compiler sees those names as costants that
represent predetermined objects. Maybe a name like "OriginalWB" would be a
better idea.


"Frank Pytel" wrote in message
...
Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the
entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to
update
the worksheet on if a client calls back. The other workbook will always be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macro to copy a one worksheet in one book to the current workbook

hi
confused. why do you need to reference workbook Q12345678.xls as thisworkbook?

regards
FSt1

"Frank Pytel" wrote:

Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to update
the worksheet on if a client calls back. The other workbook will always be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Macro to copy a one worksheet in one book to the current workbook

This would be a version that uses a variable OriginalWB to replace the
Windows("Q12345678.xls") refernce.

Sub Copy()
Dim OriginalWB As Workbook
Set OriginalWB = Worksbooks("Q12345678.xls")
Windows("BlankQuote.xls").Activate
Cells.Copy
OriginalWB.Range("A1").PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub



"JLGWhiz" wrote in message
...
If I were doing it, I would not use the name ThisWorkbook because that is
a reserved name for Excel workbooks. Using reserved names can cause
problems when running code, because the compiler sees those names as
costants that represent predetermined objects. Maybe a name like
"OriginalWB" would be a better idea.


"Frank Pytel" wrote in message
...
Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the
entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to
update
the worksheet on if a client calls back. The other workbook will always
be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Macro to copy a one worksheet in one book to the current workb

Hello JLGWhiz;

I got an error at the word Worksbooks so I took out the 's'. Now I am
getting an error that states:

Runtime Error 438:

Object doesn't support this property or method.

When I click the Debug button it highlights everthing below:


OriginalWB.Range("A1").PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

Is this saying that I cannot select the entire sheet and paste it to A1?

Thanks for your help, JLGWhiz. I sincerely appreciate it. Have a Great Day.

Frank Pytel


"JLGWhiz" wrote:

This would be a version that uses a variable OriginalWB to replace the
Windows("Q12345678.xls") refernce.

Sub Copy()
Dim OriginalWB As Workbook
Set OriginalWB = Worksbooks("Q12345678.xls")
Windows("BlankQuote.xls").Activate
Cells.Copy
OriginalWB.Range("A1").PasteSpecial _
Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub



"JLGWhiz" wrote in message
...
If I were doing it, I would not use the name ThisWorkbook because that is
a reserved name for Excel workbooks. Using reserved names can cause
problems when running code, because the compiler sees those names as
costants that represent predetermined objects. Maybe a name like
"OriginalWB" would be a better idea.


"Frank Pytel" wrote in message
...
Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the
entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to
update
the worksheet on if a client calls back. The other workbook will always
be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Macro to copy a one worksheet in one book to the current workb

Hello FSt1;

I don't. I misstated myself. I want to reference this workbook as a
variable, not as 'thisworkbook'.

Thank you for getting back so quick FSt1. Have a Great Day.

Frank Pytel

"FSt1" wrote:

hi
confused. why do you need to reference workbook Q12345678.xls as thisworkbook?

regards
FSt1

"Frank Pytel" wrote:

Hello all;

I hope someone has done this already. I want to copy the contents of a
master file into the contents of an old workbook. I want to copy the entire
worksheet, formulas formatting and all.

I recorded this macro:

<--

Sub Copy()

Windows("BlankQuote.xls").Activate
Cells.Select
Selection.Copy
Windows("Q12345678.xls").Activate
Cells.Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
End Sub

--

It works great accept I need to reference workbook Q12345678.xls as
thisWorkbook. This workbook is the older workbook that I would like to update
the worksheet on if a client calls back. The other workbook will always be
BlankQuote.xls. This workbook will be kept up to date at all times.

Can anyone help me with this please?

Thank you.

God Bless

Frank Pytel

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 current workbook Gerard Excel Discussion (Misc queries) 0 February 19th 10 03:31 PM
Macro to copy current worksheet to pre-defined wookbook sammy Excel Programming 8 August 1st 08 11:14 AM
Macro to copy active worksheet to new workbook Macca Excel Discussion (Misc queries) 1 May 25th 08 02:07 PM
copy csv worksheet to xls book using vba/vbs [email protected] Excel Programming 2 February 26th 08 01:24 PM
Copy a range of cells in an unopened workbook and paste it to the current workbook topstar Excel Programming 3 June 24th 04 12:50 PM


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