LuigiCortisone
New Member
- Joined
- Feb 12, 2009
- Messages
- 30
Hi, I have a master worksheet with code that creates a worksheet from every row. This works well but I now want to grab two cells from each row and use them to populate another column
Here is a simple screenshot of the master worksheet (dummy data) with the cells for the third column highlighted
And here is the desired result in the first worksheet after the code has run. Columns F and G for each row must populate the 3rd and 4th row of colC. Rows 1 & 2 are to be left blank
Here is the code I have already kindly provided by a forum moderator. This creates each new worksheet and transposes the first 4 columns. But now I just need to bring the other two cells across
Cheers, Luigi
Here is a simple screenshot of the master worksheet (dummy data) with the cells for the third column highlighted
And here is the desired result in the first worksheet after the code has run. Columns F and G for each row must populate the 3rd and 4th row of colC. Rows 1 & 2 are to be left blank
Here is the code I have already kindly provided by a forum moderator. This creates each new worksheet and transposes the first 4 columns. But now I just need to bring the other two cells across
Cheers, Luigi
VBA Code:
Sub LuigiCortisone()
Dim Cl As Range
Dim Hdr As Variant
With Sheets("Master")
Hdr = .Range("A1:D1").Value2
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
If Not Evaluate("isref('" & Cl.Value & "'!A1)") Then
Sheets.Add(, Sheets(Sheets.Count)).Name = Cl.Value
With Sheets(Cl.Value)
.Range("A1:A4").Value = Application.Transpose(Hdr)
.Range("B1:B4").Value = Application.Transpose(Cl.Resize(, 4).Value)
End With
End If
Next Cl
End With
End Sub