Excel Macro to sequence number fill and finally sum

Yoyes

New Member
Joined
Apr 5, 2024
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Greetings dear experts
I'm trying to create a macro to fill rows values from 0 to 9 starting at A1 and ending at A10, it also must populate B to E with the same sequence. I know I must use count and for function, and while to increase count value but I'm not being able at all to achieve it

Attached a picture that macro must done
Hope you can help me, I'm desesperate
Regards!
 

Attachments

  • Sample Data as should be.PNG
    Sample Data as should be.PNG
    54.6 KB · Views: 26

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
You say generate from 0-9 but your picture shows 0-10. Try this macro that generates 0-10.
VBA Code:
Sub GenerateSequences()
    Dim a
    Dim i As Long
    Dim ws As Worksheet
    
    Set ws = ThisWorkbook.Worksheets("Sheet5") 'change sheet name as needed
    ReDim a(1 To 11, 1 To 5)
    
    For i = 1 To 11
        For j = 1 To 5
            a(i, j) = i - 1
        Next j
    Next i
    
    ws.Range("A1").Resize(11, 5).Value = a
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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