Adding new rows for over 2000 row I have

dankar

Board Regular
Joined
Mar 23, 2016
Messages
113
Office Version
  1. 365
Platform
  1. Windows
Dear All,

I have a table with 26 Columns and 2045 Row, I need to add rows with the same exact data but depending on the number available in COL2
meaning:
If I have number 2 in COL2 then I need to add ONE row with the same exact data except having COL2 for the new added rows is BLANK
If I have number 3 in COL2 then I need to add TWO rows with the same exact data except having COL2 for the new added rows is BLANK
If I have number 1 in COL2 then NO rows to Add.
If COL2 = Blank , NO rows to Add.
If COL2 = 4 then 3 rows need to be added wit the same exact data except COL2 is black in the 3 added rows.
IF COL2 = 10 then 9 rows need to be added with the same exact data except COL2 will be blank for the new 9 rows

If there is anything in COL2 other than number nothing to add (I will do this manually as they are few).

someone told me to use Macro (but I don't know how to use Macros) if this is the solution can someone explain how.


Thank you so much for any help suggested.

[TABLE="class: outer_border, width: 510"]
<tbody>[TR]
[TD]COL1
[/TD]
[TD]COL2
[/TD]
[TD]COL3
[/TD]
[TD]COL4
[/TD]
[TD]COL5
[/TD]
[TD]COL6
[/TD]
[TD]COL7
[/TD]
[TD]COL8
[/TD]
[TD]COL9
[/TD]
[TD]COL10
[/TD]
[/TR]
[TR]
[TD]A
[/TD]
[TD]2
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[/TR]
[TR]
[TD]X
[/TD]
[TD]3
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[TD]X
[/TD]
[/TR]
[TR]
[TD]Y
[/TD]
[TD]1
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[TD]Y
[/TD]
[/TR]
[TR]
[TD]F
[/TD]
[TD]4
[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TD]
[TD]B
[/TD]
[TD]B
[/TD]
[TD]B
[/TD]
[TD]B
[/TD]
[TD]B
[/TD]
[TD]B
[/TD]
[/TR]
</tbody>[/TABLE]
 
WOW!

- Range("D" & Rw + 1).Resize(Num - 1).ClearContents ,

I didn't understand this "Resize (Num -1)."


May I ask you one last favor, How can I learn this kind of coding? can you advice me plz?

Many Many thanks !
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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