Populate data in Excel according with n
Solved/Closed
ruidelgadoalves
Posts
5
Registration date
Thursday January 26, 2012
Status
Member
Last seen
March 5, 2012
-
Feb 15, 2012 at 05:19 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 7, 2013 at 10:40 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 7, 2013 at 10:40 AM
Related:
- Populate data in Excel according with n
- Transfer data from one excel worksheet to another automatically - Guide
- Number to words in excel - Guide
- Tmobile data check - Guide
- Gif in excel - Guide
- Marksheet in excel - Guide
3 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 20, 2012 at 09:51 AM
Feb 20, 2012 at 09:51 AM
Hi Ruidelgadoalves,
Assuming that data is in sheet1, starting at row 1 (no header).
Result will be displayed in sheet2.
Correct sheet names and make backup of file first, then see if this macro yield the desired result:
Best regards,
Trowa
Assuming that data is in sheet1, starting at row 1 (no header).
Result will be displayed in sheet2.
Correct sheet names and make backup of file first, then see if this macro yield the desired result:
Sub Test() Dim lRow, lRow2, x, y As Integer lRow = Sheets("sheet1").Range("E" & Rows.Count).End(xlUp).Row For Each cell In Sheets("Sheet1").Range("E1:E" & lRow) x = cell.Value y = 0 Do Sheets("Sheet1").Select Range(Cells(cell.Row, "A"), Cells(cell.Row, "D")).Copy lRow2 = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row Sheets("Sheet2").Range("A" & lRow2).PasteSpecial y = y + 1 Loop Until x = y Next cell End Sub
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 23, 2012 at 08:17 AM
Feb 23, 2012 at 08:17 AM
Sorry Ruidel, I thought the column with R1...R9 was data too (silly me), but I see now that those are to indicate rows.
Try this code:
Sorry for the inconvenience.
Best regards,
Trowa
Try this code:
Sub Test() Dim lRow, lRow2, x, y As Integer lRow = Sheets("Folha 2").Range("D" & Rows.Count).End(xlUp).Row For Each cell In Sheets("Folha 2").Range("D1:D" & lRow) x = cell.Value y = 0 Do Sheets("Folha 2").Select Range(Cells(cell.Row, "A"), Cells(cell.Row, "C")).Copy lRow2 = Sheets("Folha 3").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row Sheets("Folha 3").Range("A" & lRow2).PasteSpecial y = y + 1 Loop Until x = y Next cell End Sub
Sorry for the inconvenience.
Best regards,
Trowa
ruidelgadoalves
Posts
5
Registration date
Thursday January 26, 2012
Status
Member
Last seen
March 5, 2012
Mar 5, 2012 at 03:31 AM
Mar 5, 2012 at 03:31 AM
Dear TrowaD,
Sorry for this late reply.
It work fine. everything is 100% as expected.
Thanks for your help.
Best regards,
ruidelgadoalves
Sorry for this late reply.
It work fine. everything is 100% as expected.
Thanks for your help.
Best regards,
ruidelgadoalves
diogogomes
Posts
1
Registration date
Wednesday March 6, 2013
Status
Member
Last seen
March 6, 2013
Mar 6, 2013 at 11:07 AM
Mar 6, 2013 at 11:07 AM
Hi, I am trying to do exactly the same with my data set but when running the macro I receive an error message "Run time error 9".
Any help on what I am doing wrong?
(i also want to populate according to column d)
column A B C D
00651R 103 1 10
00977B 80 0 7
01116A 58 0 6
01215C 66 0 7
01415K 83 1 9
02124E 67 1 8
04077I 65 0 5
09320Q 48 0 4
11135K 46 0 5
13105L 122 0 7
Thank you so much
Best regards,
Any help on what I am doing wrong?
(i also want to populate according to column d)
column A B C D
00651R 103 1 10
00977B 80 0 7
01116A 58 0 6
01215C 66 0 7
01415K 83 1 9
02124E 67 1 8
04077I 65 0 5
09320Q 48 0 4
11135K 46 0 5
13105L 122 0 7
Thank you so much
Best regards,
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Mar 7, 2013 at 10:40 AM
Mar 7, 2013 at 10:40 AM
Hi Diogogomes,
You will need to adjust the sheet names.
Change "Folha 2" to the name of your source sheet.
Change "Folha 3" to the name of your destination sheet.
If you don't like the screen flickering you can start (below first line) the code with
Application.ScreenUpdating = False
and end (before last line) it with
Application.ScreenUpdating = True
Best regards,
Trowa
You will need to adjust the sheet names.
Change "Folha 2" to the name of your source sheet.
Change "Folha 3" to the name of your destination sheet.
If you don't like the screen flickering you can start (below first line) the code with
Application.ScreenUpdating = False
and end (before last line) it with
Application.ScreenUpdating = True
Best regards,
Trowa
Feb 21, 2012 at 03:13 AM
Thank you for your effort, but it didn't solved my problem.
I changed the sheets names to Folha2 and Folha3 to suit my workbook.
In Folha 2 I have:
2009096 1001 19 5
2009097 1002 12 2
2009097 1003 36 6
2009099 1004 10 3
2009099 1005 11 3
2009099 1006 12 2
2009101 1007 13 4
.
.
.
With the macro you presented me, I obtained (after Esc and End):
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
.
.
.
(and keep repeating the same row content)
What I realy wanted was:
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009096 1001 19 5
2009097 1002 12 2
2009097 1002 12 2
2009097 1003 36 6
2009097 1003 36 6
2009097 1003 36 6
2009097 1003 36 6
2009097 1003 36 6
2009097 1003 36 6
2009099 1004 10 3
2009099 1004 10 3
2009099 1004 10 3
2009099 1005 11 3
2009099 1005 11 3
2009099 1005 11 3
.
.
.
Thank you again for all your help on this.
Best regards,