用于在excel中将行拆分为不同工作表的宏 [英] Macro for splitting rows into different sheets in excel

查看:128
本文介绍了用于在excel中将行拆分为不同工作表的宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Team,

任何人都可以协助我设置宏来将Excel工作表中的批量行拆分为不同的每张200行?

can anyone assist me in setting up a macro to split bulk rows in an excel sheet into different sheets of 200 lines each?

问候,

Binu Joseph89

Binu Joseph89

推荐答案

Binu,

re:数据到多张纸




'---

Sub EmptyTheBag()

'Jim Cone - 2018年4月 - https://goo.gl / IUQUN2

  Dim N As Long

  Dim S As Long

  Dim LastRow As Long

 

  S = 2

  LastRow =工作表(1).Cells(工作表(1).Rows.Count,1).End( xlUp)。行为
 对于N = 201到LastRow步骤200

  使用工作表(1)

     .Range(.Rows(N),。Rows(N + 199))。Cut Destination:= Worksheets(S).Range(" A1")

  结束时与
   S = S + 1

  如果S> Worksheets.Count然后是
    退出为
  另外,如果N + 199> LastRow然后是
    退出为
  结束如果

 下一个

结束子

'---



Jim Cone

https://goo.gl/ IUQUN2


Binu,
re: data to multiple sheets

'---
Sub EmptyTheBag()
'Jim Cone - April 2018 - https://goo.gl/IUQUN2
 Dim N As Long
 Dim S As Long
 Dim LastRow As Long
 
 S = 2
 LastRow = Worksheets(1).Cells(Worksheets(1).Rows.Count, 1).End(xlUp).Row
 For N = 201 To LastRow Step 200
   With Worksheets(1)
     .Range(.Rows(N), .Rows(N + 199)).Cut Destination:=Worksheets(S).Range("A1")
   End With
   S = S + 1
   If S > Worksheets.Count Then
     Exit For
   ElseIf N + 199 > LastRow Then
     Exit For
   End If
 Next
End Sub
'---

Jim Cone
https://goo.gl/IUQUN2


这篇关于用于在excel中将行拆分为不同工作表的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆