ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing a macro (https://www.excelbanter.com/excel-programming/349983-writing-macro.html)

Sylvia[_6_]

Writing a macro
 

I have one excel sheet which is exported from some other programme.
There are several blocks in it. Each block is seperated by one or two
blank rows. I want to seperate these blocks in different excel tabs.
How can I do that? Can anyone helpme for this?


--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile: http://www.excelforum.com/member.php...o&userid=30300
View this thread: http://www.excelforum.com/showthread...hreadid=499679


Bernie Deitrick

Writing a macro
 
Sylvia,

Select your sheet, and run the macro below.

HTH,
Bernie
MS Excel MVP


Sub Macro1()
Dim myArea As Range
Dim Counter As Integer

Counter = 0

For Each myArea In Cells.SpecialCells(xlCellTypeConstants, 23).Areas
Counter = Counter + 1
Worksheets.Add.Name = "Area " & Counter
myArea.Copy Range("A1")
Next myArea

End Sub


"Sylvia" wrote in message
...

I have one excel sheet which is exported from some other programme.
There are several blocks in it. Each block is seperated by one or two
blank rows. I want to seperate these blocks in different excel tabs.
How can I do that? Can anyone helpme for this?


--
Sylvia
------------------------------------------------------------------------
Sylvia's Profile: http://www.excelforum.com/member.php...o&userid=30300
View this thread: http://www.excelforum.com/showthread...hreadid=499679





All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com