Macro to fill column

Xirom431

Board Regular
Joined
Dec 2, 2010
Messages
102
Hi,

I need help with a macro to fill column with value that will skip cell. For example, I need to fill column with value X but skip every other row or every 5 range from A3 to A1000. Thanks for the help in advance.

X or X or X
X
X

X X
X
X X
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I'm not sure either from your description or your diagram exactly what you want but perhaps the code below will get you started and you can post back with whatever you need to act differently.

Code:
Sub xxx()
    Dim x As Long, i As String

    i = InputBox("Please enter value to insert")

    For x = 3 To 1000 Step 4
        Cells(x, "A").Resize(3, 1).Value = i
    Next

End Sub
 
Upvote 0
I have a formula in Cell A3. I would like to copy the same formula down the column but skip every other cell and range from A3:A1000

X
Skip
X
Skip
X


or this scenario

X
X
Skip
Skip
X
X


or

X
X
X
X
Skip
Skip
Skip
Skip
X
X
X
X

Basically it looks like a power of 2.
 
Upvote 0
You will have to adjust the 1000 to exactly what you want in each

Code:
Sub xxx()
    Dim x As Long, i As String

    

    For x = 3 To 1000 Step 2
    Range("a3").Copy Cells(x, "A")
    Next

End Sub
Code:
Sub xxx2()
    Dim x As Long, i As String

    

    For x = 3 To 1000 Step 4
    Range("a3").Copy Cells(x, "A").Resize(2, 1)
    Next

End Sub
Code:
Sub xxx3()
Dim x As Long, i As String

    

    For x = 3 To 1000 Step 8
    Range("a3").Copy Cells(x, "A").Resize(4, 1)
    Next

End Sub
 
Upvote 0
Something is wrong. The macro is working with regular number only. I have formula in Cell V3 and it will indent to the left and run over to the previous column
 
Upvote 0
Sorry, no idea it works fine with formulas for me. I put a formula in A3, ran the first macro and got the results you see in the formula box in the image below

Excel Workbook
ABCD
35715
418
55924
618
76917
826
95726
1012
115819
1213
137226
1421
156725
1621
176321
1823
194019
2010
215111
Sheet1
 
Upvote 0
Something is wrong. The macro is working with regular number only. I have formula in Cell V3 and it will indent to the left and run over to the previous column

Please show your formula and an example of your data and how are your cells formatted?

+ what shows in your formula bar when you click a cell (both V3 and one of the other cells)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,795
Members
449,048
Latest member
greyangel23

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