How to create by 1-100 row to 1 sheet then loop next to...

Faozan

Banned user
Joined
May 14, 2023
Messages
25
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
1-100 = sheet(1)
101-199 = sheet(2)
200-299= sheet(3)
 
Maybe the below to do it on every worksheet in the workbook:
VBA Code:
Sub test()
    Dim ws As Worksheet, x As Long
    
    x = 1
    For Each ws In Sheets
        ws.Range("A1:A100") = Evaluate("SEQUENCE(100,1," & x & ",1)")
        x = x + 100
    Next ws
End Sub
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
While import file will have many row maybe more than 5000 row, so I want to cut 1-100 row to in 1 excel and then 101-201 loop file until to 5000 row.

Sub test()
Sheet60.Range("A1:BX100").Copy
Workbooks.Add
Application.DisplayAlerts = False
ActiveSheet.Paste Destination:=Range("A1")
ActiveWorkbook.SaveAs ("D:\Implement\")
ActiveWorkbook.Close
Application.DisplayAlerts = True
This you want in how many sheets. Since it cannot loop to infinite sheets, which does not help in any way
 
Upvote 0
Maybe the below to do it on every worksheet in the workbook:
VBA Code:
Sub test()
    Dim ws As Worksheet, x As Long
  
    x = 1
    For Each ws In Sheets
        ws.Range("A1:A100") = Evaluate("SEQUENCE(100,1," & x & ",1)")
        x = x + 100
    Next ws
End Sub

[/QUOTE]

While import file will have many row maybe more than 5000 row, so I want to cut 1-100 row to in 1 excel and then 101-201 loop file until to 5000 row.

Sub test()
Sheet60.Range("A1:BX100").Copy
Workbooks.Add
Application.DisplayAlerts = False
ActiveSheet.Paste Destination:=Range("A1")
ActiveWorkbook.SaveAs ("D:\Implement\")
ActiveWorkbook.Close
Application.DisplayAlerts = True
 
Upvote 0
Loop to do what?

Your original post is so short you are leaving us guessing at what it is you want to do.

Also
1-100 = sheet(1) = 100 cells
101-199 = sheet(2) = 99 cells
200-299= sheet(3) = 100 cells
299 cells in total.

While import file will have many row maybe more than 5000 row, so I want to cut 1-100 row to in 1 excel and then 101-201 loop file until to 5000 row.

Sub test()
Sheet60.Range("A1:BX100").Copy
Workbooks.Add
Application.DisplayAlerts = False
ActiveSheet.Paste Destination:=Range("A1")
ActiveWorkbook.SaveAs ("D:\Implement\")
ActiveWorkbook.Close
Application.DisplayAlerts = True
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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