Writing a macro

  • Thread starter Thread starter Sylvia
  • Start date Start date
S

Sylvia

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,

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top