VBA Count Cells In A Range And Paste In 5 Strings For Each Count

Lewzerrrr

Active Member
Joined
Jan 18, 2017
Messages
256
Hey,

So I have a 5 strings of text that I need to duplicate for every cell count in a range.

Example below: there's 5 instances of count (don't include header in range, but this also needs to be dynamic). For every instance I want to repeat String1, String2.. String5 5 times.

Any help is appreciated :)

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl63, width: 64"]Header1[/TD]
[TD="class: xl63, width: 64"]Header2[/TD]
[/TR]
[TR]
[TD="class: xl63"]Count1[/TD]
[TD="class: xl63"]String1[/TD]
[/TR]
[TR]
[TD="class: xl63"]Count2[/TD]
[TD="class: xl63"]String2[/TD]
[/TR]
[TR]
[TD="class: xl63"]Count3[/TD]
[TD="class: xl63"]String3[/TD]
[/TR]
[TR]
[TD="class: xl63"]Count4[/TD]
[TD="class: xl63"]String4[/TD]
[/TR]
[TR]
[TD="class: xl63"]Count5[/TD]
[TD="class: xl63"]String5[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String1[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String2[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String3[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String4[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String5[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String1[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String2[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String3[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String4[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String5[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String1[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String2[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String3[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String4[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String5[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String1[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String2[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String3[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String4[/TD]
[/TR]
[TR]
[TD="class: xl63"] [/TD]
[TD="class: xl63"]String5[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG19Oct07
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
[COLOR="Navy"]With[/COLOR] Rng.Offset(, 1)
    .Copy Destination:=.Resize(Rng.Count * 5)
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,121
Members
452,381
Latest member
Nova88

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