Create new worksheet from list and copy information from that row to new sheet

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
701
Office Version
  1. 365
Hi All

I'm trying to do something all with one macro to save some time if it's possible.

I have a worksheet currently with just over 100 rows, in column A I have a list of the new worksheets I'd like to create. In columns B to M adjacent i have the information that I'd like to copy to the new worksheet and transpose it the process.

So basically an example would be: Create a new worksheet named after the content of A2, Copy the information from B2:M2 paste into A1 to the newly created sheet and transpose, when this is done move to A3 and repeat.

Any help would be appreciated

cheers

Paul
 
Hi All

I'm trying to do something all with one macro to save some time if it's possible.

I have a worksheet currently with just over 100 rows, in column A I have a list of the new worksheets I'd like to create. In columns B to M adjacent i have the information that I'd like to copy to the new worksheet and transpose it the process.

So basically an example would be: Create a new worksheet named after the content of A2, Copy the information from B2:M2 paste into A1 to the newly created sheet and transpose, when this is done move to A3 and repeat.

Any help would be appreciated

cheers

Paul
Does this do what you need?

Change the name of the main sheet where indicated.

VBA Code:
Public Sub subCopyToNewSheets()
Dim rngList As Range
Dim WsMain As Worksheet
Dim rng As Range

  ActiveWorkbook.Save

  Set WsMain = Worksheets("Main") '<<<< Change main worksheet name as appropriate >>>>
  
  For Each rng In WsMain.Range("A2:A" & WsMain.Cells(WsMain.Rows.Count, "A").End(xlUp).Row).Cells
  
    If Not Evaluate("isref('" & rng.Value & "'!A1)") Then
      Worksheets.Add After:=Sheets(Sheets.Count)
      With ActiveSheet
        .Name = rng.Value
        .Range("A1:A12").Value = Application.WorksheetFunction.Transpose(rng.Offset(0, 1).Resize(1, 12))
      End With
    End If
  Next rng
    
End Sub
 
Upvote 0
Does this do what you need?

Change the name of the main sheet where indicated.

VBA Code:
Public Sub subCopyToNewSheets()
Dim rngList As Range
Dim WsMain As Worksheet
Dim rng As Range

  ActiveWorkbook.Save

  Set WsMain = Worksheets("Main") '<<<< Change main worksheet name as appropriate >>>>
 
  For Each rng In WsMain.Range("A2:A" & WsMain.Cells(WsMain.Rows.Count, "A").End(xlUp).Row).Cells
 
    If Not Evaluate("isref('" & rng.Value & "'!A1)") Then
      Worksheets.Add After:=Sheets(Sheets.Count)
      With ActiveSheet
        .Name = rng.Value
        .Range("A1:A12").Value = Application.WorksheetFunction.Transpose(rng.Offset(0, 1).Resize(1, 12))
      End With
    End If
  Next rng
   
End Sub
Hi, many thanks for your help, it worked like a charm and saved me hours of work.
 
Upvote 0

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