challenge for me

bongobus

New Member
Joined
Jul 11, 2017
Messages
28
i have 4 columns containing data


a is employee number example 123132
b is employee name example joe blogs
c is a number

so example

123132 Joe Bloggs 1.00
213233 Peter Jones 1.00
213167 Sea Young 1.00

heres the challenge

if the column c says 3.00

i want this to create in total 2 additional rows for that person

or again if says 6.00 then 5 additional rows for that person

so heres the example

123132 Joe Bloggs 1.00
213233 Peter Jones 3.00
213167 Sea Young 1.00
213233 Peter Jones
213233 Peter Jones


or another example

123132 Joe Bloggs 6.00
213233 Peter Jones 3.00
213167 Sea Young 1.00
123132 Joe Bloggs
123132 Joe Bloggs
123132 Joe Bloggs
123132 joe Bloggs
123132 Joe Bloggs
213233 Peter Jones
213233 Peter Jones


hope the above clear ? lol
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Assuming your data starts in "A1", Give this a try:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG24Aug18
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] K [COLOR="Navy"]As[/COLOR] Variant, ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng: [COLOR="Navy"]Set[/COLOR] .Item(Dn.Value) = Dn: [COLOR="Navy"]Next[/COLOR]
c = Rng.Count
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] K [COLOR="Navy"]In[/COLOR] .keys
    [COLOR="Navy"]For[/COLOR] ac = 1 To .Item(K).Offset(, 3).Value - 1
        c = c + 1
        Cells(c, 1) = .Item(K)
        Cells(c, 2) = .Item(K).Offset(, 1).Value
        Cells(c, 3) = .Item(K).Offset(, 2).Value
    [COLOR="Navy"]Next[/COLOR] ac
[COLOR="Navy"]Next[/COLOR] K
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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