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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

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