Building a new spreadsheet using information from another
Solved/Closed
wtmayoza
Posts
3
Registration date
Tuesday December 13, 2016
Status
Member
Last seen
December 13, 2016
-
Dec 13, 2016 at 12:30 PM
wtmayoza Posts 3 Registration date Tuesday December 13, 2016 Status Member Last seen December 13, 2016 - Dec 13, 2016 at 05:48 PM
wtmayoza Posts 3 Registration date Tuesday December 13, 2016 Status Member Last seen December 13, 2016 - Dec 13, 2016 at 05:48 PM
Related:
- Building a new spreadsheet using information from another
- Pc building simulator 2 free download - Download - Simulation
- Formula spreadsheet definition - Guide
- Google spreadsheet right to left - Guide
- 3d building design software free download - Download - CAD
- Pc building simulator free download - Download - Simulation
2 responses
Can we assume that the new sheet is located in the same workbook as the original sheet, and initially empty (except for the first line) ?
Proposal :
Option Explicit
Sub wtmayoza()
Dim wbo As Worksheet, wbn As Worksheet
Dim lastcol As Long 'last colum to handle in original sheet
Dim i As Long
Dim origline As Long, newline As Long
Set wbo = ThisWorkbook.Sheets("orig")
Set wbn = ThisWorkbook.Sheets("new")
origline = 2
newline = 2
lastcol = 2
Do While wbo.Cells(1, lastcol + 1) <> ""
lastcol = lastcol + 1
Loop 'Do While wbo.Cells(1, totcol + 1) <> ""
Do While wbo.Cells(origline, 1) <> ""
For i = 3 To lastcol
wbn.Cells(newline, 1) = wbo.Cells(origline, 2)
wbn.Cells(newline, 2) = wbo.Cells(origline, 1)
wbn.Cells(newline, 3) = wbo.Cells(origline, i)
wbn.Cells(newline, 4) = wbo.Cells(1, i)
newline = newline + 1
Next i
origline = origline + 1
Loop 'Do While wbo.Cells(origline, 1) <> ""
End Sub
wtmayoza
Posts
3
Registration date
Tuesday December 13, 2016
Status
Member
Last seen
December 13, 2016
Dec 13, 2016 at 05:48 PM
Dec 13, 2016 at 05:48 PM
You are so good! Thank you for your help.
Dec 13, 2016 at 05:40 PM
Thanks