Emanuele
New Member
- Joined
- Feb 25, 2020
- Messages
- 14
- Office Version
- 2016
- Platform
- Windows
Hi guys, I would like to know if there is a way to add more than 1 adjacent column for the presented code that I found on Internet and that Fluff helped me to modify in this Post
Furthermore it's possible to apply a string extract (for example, extract the first 4 and the last 4 characters and put them in different column)?
Thank you
Furthermore it's possible to apply a string extract (for example, extract the first 4 and the last 4 characters and put them in different column)?
Thank you
VBA Code:
Set DestSh = ActiveWorkbook.Worksheets.Add
DestSh.Name = "Statistics"
' Find the last column with data on the summary
' worksheet.
Last = LastCol(DestSh)
' Loop through all worksheets and copy the data to the
'summary worksheet.
For Each sh In ActiveWorkbook.Worksheets
If sh.Name <> DestSh.Name Then
' Fill in the columns that you want to copy.
Set Copy1 = sh.Range("C8:AZ8")
'Set Copy2 = sh.Range("C10:AZ10") 'second possible column'
'Set Copy3 = sh.Range("C11:AZ11") 'extract the first 4 characters and put in a column then the last 4 characters and put in adjacent column
' This statement copies and transpose the valuse
With Copy1
.Value
DestSh.Cells(Rows.Count, Last + 1).End(xlUp).Offset(1).Resize(.Columns.Count).Value = Application.Transpose(.Value)
End With
' With Copy2
' DestSh.Cells(Rows.Count, Last + 1).End(xlUp).Offset(1).Resize(.Columns.Count).Value = Application.Transpose(.Value)
'End With
' With Copy3
' DestSh.Cells(Rows.Count, Last + 1).End(xlUp).Offset(1).Resize(.Columns.Count).Value = Application.Transpose(.Value)
'End With
End If
Next