Skip a line after the last record

RCONDADO

New Member
Joined
Nov 4, 2014
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Dear all,

I'm creating a macro to compile some information into a spreadsheet, and inside it, I'm using the following code:

" Sheets("Controle").Select
Sheets("Controle_Draft").Visible = True
Range(Selection, Selection.End(xlToRight)).Select
Sheets("Controle_Draft").Select
Range("A2:L9").Select
Selection.Copy
Sheets("Controle").Select
Range("A1").Select
Selection.End(xlDown).Select
Sheets("Controle").Rows("2:2").Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Controle_Draft").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Controle").Select
Range("A1").Select
Selection.End(xlDown).Select "

After that, I entered the code to paste the information. The main idea is that it finds the last filled row, and pastes the information from the source sheet, but it's overwriting the last record and doesn't do anything after row 8.

Please could you help me?

Thank you in advance.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
59,071
Office Version
  1. 365
Platform
  1. Windows
"xlDown" will take you to the last populated row, not the first blank row after that.
You can use .Offset(1,0) to move one row down from that.

If you need more help, I would recommend posting some samples of the data you are trying to copy, and the destination you are trying to copy it to (I think it would be much easier for us to follow along to view your data that to try to decipher code with no idea of what your data looks like).

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.
 

Forum statistics

Threads
1,141,616
Messages
5,707,419
Members
421,509
Latest member
someinternetuser

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
Top