How to Use VBA to Copy One Column into Multiple Excel Columns
Question details
The user needs to copy the values from one specific Excel column and repeat them across multiple adjacent columns (such as columns B through Z) using a VBA loop.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Automating the horizontal duplication of a data column across a specified number of target columns without copying underlying formulas.
- Observed behavior
- The user requires a macro that accurately repeats each source value across the destination columns while preserving values only, instead of manually copying and pasting.
Ensure you have enabled the Developer tab in your spreadsheet ribbon and enabled macro execution in your Trust Center settings before running any VBA code.
Use a VBA Loop with the Offset Function
This method uses a simple loop combined with the Offset function to duplicate a specific range of values across a set number of columns next to the original data.
By setting the value of an offset range directly to the value of the source range, you bypass the clipboard. This is faster and ensures only the raw values are pasted.
Press 'Alt + F11' on your keyboard to open the Visual Basic for Applications (VBA) editor. Click on 'Insert' in the top menu and select 'Module'.
In the new module window, define your subroutine and source range. Then, write a For loop that dictates how many columns to copy across. For example: `Sub CopyColumns()` `Dim myRange As Range` `Dim x As Integer` `Set myRange = ActiveSheet.Range("A1:A100")` `For x = 1 To 25` `myRange.Offset(0, x).Value = myRange.Value` `Next x` `End Sub`
Place your cursor inside the macro code block and press 'F5', or click the green 'Run' button in the toolbar. The values from your source column will instantly populate the next 25 columns.

Iterate Through Rows Dynamically
If your source column length changes dynamically, you can use a VBA script that first counts the number of used rows before copying the cells.
Run Macros and VBA seamlessly with WPS Spreadsheet
WPS Office provides robust support for Excel macros and VBA scripts, allowing you to automate repetitive tasks like copying columns with familiar coding syntax.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open the spreadsheet containing the column you want to copy.
- 2. Access the Macro Editor: Navigate to the 'Developer' tab on the ribbon and click on 'Macros' or 'Visual Basic' to open the built-in VBA editor.
- 3. Paste and run your script: Paste your copying loop script into a new module and click 'Run' to instantly duplicate your data across multiple columns.

Frequently Asked Questions
Can I copy formats along with the values using VBA?
Yes. If you want to copy formatting in addition to the values, you cannot use the `.Value = .Value` method. Instead, you should use the `Copy` method combined with `PasteSpecial xlPasteFormats` inside your loop.
How do I start the copy from a different column?
You can adjust the starting column by changing the source range in your code. For example, to start from column C, modify your range definition to `Set myRange = Range("C1:C100")`.
Why am I getting an 'Out of Range' error when running the loop?
This error typically occurs if your loop attempts to paste data beyond the maximum number of columns allowed in a spreadsheet (16,384 columns in standard modern worksheets). Ensure your loop limit combined with your starting column does not exceed this boundary.




