VBA Code - Copy To Next Empty Row After B13

glerwell

Well-known Member
Joined
Jun 25, 2006
Messages
1,082
Hi

I'm looking for a VBA code that will copy some data into the next empty row after row 13.

So if rows 13-18 have data in column B then the data would be copied to B19.

I know how to copy the data via VBA but I'm unsure on how to start the code, so that if finds the relevent row.

Basically I have data starting in B13 and all the new data added would be placed in each new blank row after.

I would also like it to be coded so that it can be run on any sheet as long as it is active. So the new data would be copied to the next blank row in the active sheet.

Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello,

The following code will select the first blank cell in column B after B13.

Code:
ActiveSheet.Range("B13").Select
If ActiveCell.Offset(1, 0) <> "" Then
    Selection.End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
Then just place your copy code after it.

Hope this helps!
 
Upvote 0
Why all the Selects?

Code:
Sub test()
Dim x As Long
x = Range("B" & Rows.Count).End(xlUp).Row
If x < 13 Then x = 13
Range("A1").Copy Range("B" & x + 1)
Application.CutCopyMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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