Create sheets from column B contents

adamsm

Active Member
Joined
Apr 20, 2010
Messages
444
Hi anyone,

How could I write a macro code that would create sheets with the names of content in column B of the active sheet.

Any help on this would be kindly appreciated.

Thanks in advance.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Thanks for the reply but does the code in the thread copy the cell contents? What I'm trying to get is to create sheets with the name of the contents in column B from 4 to 38.

Any help on this would be kindly appreciated.
 
Upvote 0
Are you referring to the following code as I can see a bunch of codes?

Code:
Sub Lapta() Dim lastrow As Long, LastCol As Integer, i As Long, iStart As Long, iEnd As Long Dim ws As Worksheet Application.ScreenUpdating = False With ActiveSheet     lastrow = .Cells(Rows.Count, "A").End(xlUp).Row     LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column     .Range(.Cells(2, 1), Cells(lastrow, LastCol)).Sort Key1:=Range("H2"), Order1:=xlAscending, _         Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom     iStart = 2     For i = 2 To lastrow         If .Range("H" & i).Value <> .Range("H" & i + 1).Value Then             iEnd = i             Sheets.Add after:=Sheets(Sheets.Count)             Set ws = ActiveSheet             On Error Resume Next             ws.Name = .Range("H" & iStart).Value             On Error GoTo 0             ws.Range(Cells(1, 1), Cells(1, LastCol)).Value = .Range(.Cells(1, 1), .Cells(1, LastCol)).Value             .Range(.Cells(iStart, 1), .Cells(iEnd, LastCol)).Copy Destination:=ws.Range("A2")             iStart = iEnd + 1         End If     Next i End With Application.CutCopyMode = False Application.ScreenUpdating = True End Sub</pre>
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

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