Copying data based on a value in another cell

tenbellies

New Member
Joined
May 8, 2018
Messages
6
Hi,

I have an very large excel sheet, changes regularly with new info, what I need to do is copy part of this into a blank S/Sheet but I do need multiple entries depending on a criteria

In Column A I have a name EG Bob
In
Column
B a number value EG 3

What I want to do is copy the data in
Column
A into a new spreadsheet (column A) the same number of times based on the number in column B EG if the number value is 3 copy Bob three times in cells under each other (same would be if the number was 30)

Hopefully this makes sense
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
You said:
into a new spreadsheet

Do you mean new Workbook or Worksheet
We no longer use the term Spreadsheet.

And do we need to make a new Worksheet?
And if so what name do we give the new Worksheet
What is the name of the original Worksheet?
 
Upvote 0
Assuming you want to copy data from sheet(1)
And paste new data into sheet(2)
Try this:
Code:
Sub Test()
'Modified 5/8/2018 9:30 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastrowa As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Lastrowa = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
    For i = 2 To Lastrow
        Lastrowa = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
        Cells(i, 1).Copy Sheets(2).Cells(Lastrowa, 1).Resize(Cells(i, 2))
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

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