Macro for auto-filling down a column

bcexcel

New Member
Joined
Feb 6, 2025
Messages
1
Office Version
  1. 365
  2. 2024
Platform
  1. Windows
Hello!

I am often needing to type in a specific set of characters down a column, all starting with the same string before -- as shown in the attached picture. The first part of the cell is never the same but it always needs to fill down BLK1 through MSD1.
1738855859995.png

I want to make a macro that could make it so I just need to type string-BLK1 in the first cell and then highlight it and then down 5 cells for it to auto populate the way I want. Is this possible? I don't need someone to design the code, I would just like pointers on how to get this going.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I would use the Worksheet_Change event to detect when you add a value ending in "-BLK1" to that column. Then it is very simple to extract the prefix, and then add the next four values in the next four rows. You wouldn't highlight or drag, the macro would run automatically as soon as you type in the first value. It should also check to ensure that there are four blank rows afterwards to have room to fill it in.

Hopefully those are the pointers you're looking for but it would take me about 5 minutes to write the code if you need more help.
 
Upvote 0

Forum statistics

Threads
1,226,474
Messages
6,191,224
Members
453,648
Latest member
graduateguardian

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