Copy format to another sheet

KirovHC

New Member
Joined
Jan 19, 2021
Messages
32
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi everyone,
I'm having issues creating this task:
* copy format cells from sheet 1 (range of cells A1: F6, some cells are merged)
* paste format on sheet 2 but paste on the first available line.
How would you write the code for this task?
I'm pretty new on VBA and i'm going crazy :oops:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the Board!

I find the easiest thing to do is just select/copy the whole first sheet to the second, then delete all the data.
If you use the Macro Recorder and record yourself doing this, you will get the VBA code that you need.
 
Upvote 0
Welcome to the Board!

I find the easiest thing to do is just select/copy the whole first sheet to the second, then delete all the data.
If you use the Macro Recorder and record yourself doing this, you will get the VBA code that you need.
Hello!
I've done something similiar but problem is add all the copy/pasted on the last blank row!
I try to explain myself better: the second sheet will have a predetermined format to insert data, what I have to do is copy this format from the first sheet (essentially some cells formatted with borders and colors) and copy it in the second sheet in such a way that the operator always has a "table" available to enter data without doing it manually
 
Upvote 0
I am sorry, it really isn't clear to me what you are trying to do. In these cases, seeing an example is often very helpful.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
I am sorry, it really isn't clear to me what you are trying to do. In these cases, seeing an example is often very helpful.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Here is an example:
I need to enter the cell layout A16:H20 in the first available blank row.
 

Attachments

  • img.JPG
    img.JPG
    56.3 KB · Views: 3
Upvote 0
I need to enter the cell layout A16:H20 in the first available blank row.
Will you ALWAYS be copying from the range A16:H20?
If not, how will you determine what range needs to be copied?

And we will always be posting it to the first available cell in column A on the other sheet, right?
What are the names of the two sheets?
 
Upvote 0
Will you ALWAYS be copying from the range A16:H20?
If not, how will you determine what range needs to be copied?
I'm copying this from an hidden sheet so basically cells range will be always the same (A1:H5 or whatever).
I wanted to do something more complex like manually insert in a form the range cells to be copied in a form but I am not yet at this level
And we will always be posting it to the first available cell in column A on the other sheet, right?
What are the names of the two sheets?
Yes, Sheet1 and Sheet2
 
Upvote 0
Mainwhile I tried with this simple code that seems working now

VBA Code:
Private Sub CommandButton1_Click()
Sheets("Sheet1").Range("A1:Y5").Copy Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub
 
Upvote 0
Sorry, I had stepped away for lunch for a little bit.
Yep, that should work.
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,840
Members
449,193
Latest member
MikeVol

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top