Copying data to another sheet with CurrentRegion.Rows and ignore formula columns

Xproject

New Member
Joined
Oct 25, 2017
Messages
2
Hi,
I have a button to copy some cells to Sheet9. Please see the code below. This code copy data to next empty row in Sheet9. However, I have some math formula/function in column M, N and P in Sheet9. When I press the button, it's copying to the end after the last function row.

How do I make it so that its ignore function and copy to the next empty row in Sheet9 based on column A?
Code:
Private Sub copy1_Click()
erw = Sheet9.Cells(1, 1).CurrentRegion.Rows.Count + 1


Sheet9.Cells(erw, 1) = Range("B2")
Sheet9.Cells(erw, 2) = Range("C3")
Sheet9.Cells(erw, 3) = Range("C4")
Sheet9.Cells(erw, 4) = Range("C5")
Sheet9.Cells(erw, 9) = Range("C6")
Sheet9.Cells(erw, 10) = Range("C12")
Sheet9.Cells(erw, 11) = Range("C16")
Sheet9.Cells(erw, 12) = Range("C14")


End Sub
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi & welcome to MrExcel
Try
Code:
erw = Sheet9.Range("A" & Rows.Count).End(xlUp).Offset(1).Row
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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