VBA/Macro: Copying a cell for an indefinite number of cells.

jrader

New Member
Joined
Feb 23, 2015
Messages
2
So I have the following table (though much longer, thousands of rows), and I need to make it look like the second table. That means taking the number in P Type and paste it down in P Level until the next number in P Type, where I repeat the process, and so on (observe the difference between the two tables). A macro wouldn't work, or at least I wouldn't know how to make a macro work, and I've never used VBA. How exactly would I automate this? Thank you.

I have excel 2011 on mac.


GameP LevelP Type
11
1AA
1AK
1AS
1SA
1AA
1SKA
12
1AA
1SK
1A
1SA
1AK
21
2AA
2A
2AK
2SKA
22
2AA
2A
2SKA
23
2A
2AA
31
3A
32
3AA

<tbody>
</tbody>



GameP LevelP Type
11
11AA
11AK
11AS
11SA
11AA
11SKA
12
12AA
12SK
12A
12SA
12AK
21
21AA
21A
21AK
21SKA
22
22AA
22A
22SKA
23
23A
23AA
31
31A
32
32AA

<tbody>
</tbody>
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this in "B3" and drag down
Code:
=IF(ISNUMBER(C2),C2,IF(ISNUMBER(C3),"",B2))
 
Last edited:
Upvote 0
Try this in "B3" and drag down
Code:
=IF(ISNUMBER(C2),C2,IF(ISNUMBER(C3),"",B2))


That ended up doing the trick, except for a more complicated form:

=IF(ISNUMBER(D2221),D2221,IF(ISNUMBER(D2220),D2220,IF(ISNUMBER(D2219),D2219,IF(ISNUMBER(D2218),D2218,IF(ISNUMBER(D2218),D2218,IF(ISNUMBER(D2217),D2217,IF(ISNUMBER(D2216),D2216,IF(ISNUMBER(D2215),D2215,IF(ISNUMBER(D2214),D2214,IF(ISNUMBER(D2213),D2213,IF(ISNUMBER(D2212),D2212,IF(ISNUMBER(D2211),D2211,IF(ISNUMBER(D2210),D2210,IF(ISNUMBER(D2209),D2209,IF(ISNUMBER(D2208),D2208,IF(ISNUMBER(D2207),D2207,IF(ISNUMBER(D2206),D2206,IF(ISNUMBER(D2205),D2205,IF(ISNUMBER(D2204),D2204,IF(ISNUMBER(D2203),D2203,IF(ISNUMBER(D2202),D2202,IF(ISNUMBER(D2201),D2201,IF(ISNUMBER(D2200),D2200,IF(ISNUMBER(D2199),D2199,12345))))))))))))))))))))))))
 
Upvote 0

Forum statistics

Threads
1,215,831
Messages
6,127,142
Members
449,363
Latest member
Yap999

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