VBA inserting rows then pasting predefined values

ant8989

New Member
Joined
May 11, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. MacOS
Hi forum,

I have cleaned data and removed duplicates, now I need to add 16 pre-defined values (category_locale) for every category_id

The category_id's are not always increasing by 1 as some times they will skip sequence.

Screen Shot 2021-05-11 at 5.07.18 PM.png



Meaning category_id 3565, should have 16 different category_locale's (as rows) and so should 3566 and so on.


Screen Shot 2021-05-11 at 5.16.41 PM.png



The different category_locale's are language codes, so each category_id will have a language code. There are 16 language codes for each category_id

1620728420255.png


I have been trying to insert 15 rows, and then copying the set values however it just isn't working for me.

Is the best way to copy the first 3 cells in a row, then insert that 15 times and then paste in the 16 set values, and repeat ?

Any help or guidance you can provide would be greatly appreciated.

Thank you
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
How about
VBA Code:
Sub ant()
   Dim i As Long
   Dim ary As Variant
   ary = Array("ar", "de", "en", "es", "fr", "he", "it", "ja", "ko", "my", "pt", "ru", "th", "tr", "vi", "zh")
   ary = Application.Transpose(ary)
   Application.ScreenUpdating = False
   For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
      Rows(i + 1).Resize(15).Insert
      Range("A" & i).Resize(16, 3).FillDown
      Range("D" & i).Resize(16).Value = ary
   Next i
End Sub
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,180
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