jameslytle
New Member
- Joined
- Jul 30, 2018
- Messages
- 21
I have tried this multiple ways until I am blue in the face and have not been able to solve it. I am trying to copy one worksheet and paste it into a new one. What I am doing is have a template worksheet that is used to create duplicate worksheets (as needed) that can be modified while retaining the template with no modifications.
Below is what I have so far. The lines that are remarked out is where I start to run into issues.
***************************
Sheets.Add.Name = "CharData_" & Me.CharLastText.Text
'Sheets(CharData_Template).Copy
'Sheets("CharData_" & Me.CharLastText.Text).Paste
Sheets.Add.Name = "CharSheet_" & Me.CharLastText.Text
'Sheets("CharSheet_Template").UsedRange.Copy
'Sheets("CharSheet_" & Me.CharLastText.Text).Paste
Sheets("CharData_" & Me.CharLastText.Text).Range("B2") = Me.CharFirstText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B3") = Me.CharLastText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B4") = Me.PlayFirstText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B5") = Me.PlayLastText.Text
*********************************
What I am doing is using a UserForm to capture data and then creating the new worksheets from the templates to be able to place the data obtained from the UserForm. These templates have some formatting (i.e. cell size, Merged cells and others) that I need to keep in tact after the new worksheet is created.
Everytime I put in the remarked lines I get an error code and it will not copy the data. The one time I got it to copy the data to the new worksheet it did not retain the formatting from the cells. Additional information; I have tried the command "Paste =:xlpasteformat (or pasteall) and it still did not work.
Any help is appreciated.
Jim
Below is what I have so far. The lines that are remarked out is where I start to run into issues.
***************************
Sheets.Add.Name = "CharData_" & Me.CharLastText.Text
'Sheets(CharData_Template).Copy
'Sheets("CharData_" & Me.CharLastText.Text).Paste
Sheets.Add.Name = "CharSheet_" & Me.CharLastText.Text
'Sheets("CharSheet_Template").UsedRange.Copy
'Sheets("CharSheet_" & Me.CharLastText.Text).Paste
Sheets("CharData_" & Me.CharLastText.Text).Range("B2") = Me.CharFirstText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B3") = Me.CharLastText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B4") = Me.PlayFirstText.Text
Sheets("CharData_" & Me.CharLastText.Text).Range("B5") = Me.PlayLastText.Text
*********************************
What I am doing is using a UserForm to capture data and then creating the new worksheets from the templates to be able to place the data obtained from the UserForm. These templates have some formatting (i.e. cell size, Merged cells and others) that I need to keep in tact after the new worksheet is created.
Everytime I put in the remarked lines I get an error code and it will not copy the data. The one time I got it to copy the data to the new worksheet it did not retain the formatting from the cells. Additional information; I have tried the command "Paste =:xlpasteformat (or pasteall) and it still did not work.
Any help is appreciated.
Jim