ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Create Sheet & Copy Stuff (https://www.excelbanter.com/excel-worksheet-functions/246472-create-sheet-copy-stuff.html)

littleredhairedgirl

Create Sheet & Copy Stuff
 
I'm copying and transposing a comma separated list from A1 in Sheet1
to a new sheet. The New sheet is created, but I get an error trying to
paste the list.


Sub AddSheet()
Dim ActNm As String
With ActiveWorkbook.Sheets
..Add after:=Worksheets(Worksheets.Count)
End With
ActNm = ActiveSheet.Name
ActiveSheet.Name = "SheetW"

Dim T As String, S As Variant
ActiveCell.Offset(1, 0).Range("A1").Select
With Worksheets("Sheet1")
T = ActiveCell.Value
End With
S = Split(T, ",")
With Worksheets("SheetW")
.Range("A1").Resize(UBound(S) + 1) = Application.Transpose(S)
End With
End Sub


All times are GMT +1. The time now is 04:55 AM.

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