Moluccanmom
New Member
- Joined
- Oct 13, 2016
- Messages
- 41
Hi,<o
></o
>
I have a macro, that copies user input and pastes it in atable on a different sheet.<o
></o
>
The table data is used for a chart. My problem is, I don’twant the chart to contain more than 10 entries. <o
></o
>
Can I somehow delete the first entry, if entry # 11 is copied or only use the last 10 entries from the table?<o
></o
>
Thank you,<o
></o
>
moluccanmom<o
></o
>
I have a macro, that copies user input and pastes it in atable on a different sheet.<o
The table data is used for a chart. My problem is, I don’twant the chart to contain more than 10 entries. <o
Can I somehow delete the first entry, if entry # 11 is copied or only use the last 10 entries from the table?<o
Code:
Sub Copy_range() <o:p></o:p>
[SIZE=3][COLOR=#000000][FONT=Calibri] <o:p></o:p>[/FONT][/COLOR][/SIZE]
[FONT=Calibri][SIZE=3][COLOR=#000000]Dim count As Integer<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]count = 5<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Do While Worksheets("Lookup").Range("Y" & count).Value <> ""<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]‘finding first empty cell<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]count = count + 1<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Loop<o:p></o:p>[/COLOR][/SIZE][/FONT]
<o:p></o:p>
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Chart").Range("B3").Copy<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Lookup").Range("Y" & count).PasteSpecial xlPasteValues<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Chart").Range("B6").Copy<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Lookup").Range("Y" & count).Offset(0, 1).PasteSpecial xlPasteValues<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Chart").Range("B7").Copy<o:p></o:p>[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Worksheets("Lookup").Range("Y" & count).Offset(0, 2).PasteSpecial xlPasteValues<o:p></o:p>[/COLOR][/SIZE][/FONT]
[SIZE=3][COLOR=#000000][FONT=Calibri] <o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]End Sub<o:p></o:p>[/FONT][/COLOR][/SIZE]
Thank you,<o
moluccanmom<o