ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to enter data into different line (https://www.excelbanter.com/excel-programming/414401-macro-enter-data-into-different-line.html)

ramzi

macro to enter data into different line
 
i have a few data in different line.. and want copy all the data into new
sheet using macro. and for next data I wanted the macro to copy to a new line
(empty line / next line after first copied data). Let say i click copy button
3 time the data will insert into new sheet in continues line and not replace
the same line.

thank you in advance

joel

macro to enter data into different line
 
The code will look something like the code below. there are two different
row counters. One counter fro the row where the data is located and a second
row counter for the destination sheet.


with sheets("New Sheet")
LastRow = .Range("A" & Rows.Count).end(xlup).Row
NewRow = LastRow + 1
end with

with activesheet
RowCount = 1
Do while Activesheet.Range("A" & RowCount) < ""

if "some test"

.Rows(RowCount).copy destination:=sheets("New Sheet").Rows(NewRow)
NewRow = NewRow + 1
end if

RowCount = RowCount + 1
loop
end with

"ramzi" wrote:

i have a few data in different line.. and want copy all the data into new
sheet using macro. and for next data I wanted the macro to copy to a new line
(empty line / next line after first copied data). Let say i click copy button
3 time the data will insert into new sheet in continues line and not replace
the same line.

thank you in advance


ramzi

macro to enter data into different line
 
dear Joel,

Thank you, it works with few modification to suite my program.

thanks

"Joel" wrote:

The code will look something like the code below. there are two different
row counters. One counter fro the row where the data is located and a second
row counter for the destination sheet.


with sheets("New Sheet")
LastRow = .Range("A" & Rows.Count).end(xlup).Row
NewRow = LastRow + 1
end with

with activesheet
RowCount = 1
Do while Activesheet.Range("A" & RowCount) < ""

if "some test"

.Rows(RowCount).copy destination:=sheets("New Sheet").Rows(NewRow)
NewRow = NewRow + 1
end if

RowCount = RowCount + 1
loop
end with

"ramzi" wrote:

i have a few data in different line.. and want copy all the data into new
sheet using macro. and for next data I wanted the macro to copy to a new line
(empty line / next line after first copied data). Let say i click copy button
3 time the data will insert into new sheet in continues line and not replace
the same line.

thank you in advance



All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com