Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default problem coping data from 1 sheet to new sheet

User clicks a button to add a new vehicle. This macro is suppose to
copy all of the data in sheet "Vehicle template", then create a new
sheet and paste to that sheet.Then it opens up a UserForm.
Later I want to figure out how to have it name the new sheet based on
data in one of the sheets. But 1st, I want this part to work.

It creates a new sheet ok, but it only pastes the contents of cell A1.
Can anyone see why the entire sheet does not paste to the new sheet?

Thanks
jeff

Sub NewSheet()

Sheets("Vehicle template").Select
ActiveCell.Cells.Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste

UserForm1.TextBox1.SetFocus
UserForm1.Show
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default problem coping data from 1 sheet to new sheet

It's your line:
ActiveCell.Cells.Select

ActiveCell refers to one cell only. Better to have a named range for your
template. For this example I named the range MyTemplate. Then this would be
your code:

Sheets.add
Range("MyTemplate").copy range("a1")

" wrote:

User clicks a button to add a new vehicle. This macro is suppose to
copy all of the data in sheet "Vehicle template", then create a new
sheet and paste to that sheet.Then it opens up a UserForm.
Later I want to figure out how to have it name the new sheet based on
data in one of the sheets. But 1st, I want this part to work.

It creates a new sheet ok, but it only pastes the contents of cell A1.
Can anyone see why the entire sheet does not paste to the new sheet?

Thanks
jeff

Sub NewSheet()

Sheets("Vehicle template").Select
ActiveCell.Cells.Select
Selection.Copy
Sheets.Add
ActiveSheet.Paste

UserForm1.TextBox1.SetFocus
UserForm1.Show
End Sub

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
Coping a whole row to another sheet daisy2008 Excel Programming 5 December 18th 08 07:31 PM
Coping whole row to new sheet Emac39 Excel Programming 1 December 11th 08 05:07 PM
WHY DOES COPING FROM SHEET TO SHEET INCREASE SIZE DRAMATICALLY? Jerry Excel Discussion (Misc queries) 0 June 1st 07 05:06 PM
Need help coping a range of data from sheet 1 to the next empty cell in sheet2 [email protected] Excel Programming 3 April 27th 06 09:31 PM
Coping a sheet James Excel Programming 2 April 7th 04 06:26 PM


All times are GMT +1. The time now is 04:08 AM.

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"