Hi
I am asking for your help for a VBA code which create new sheets from a template sheet.
I have already found and modified which works well :
but the problem is that with this code the new entries are organized in rows (A, A2, A3 etc...), while I need to transform it into columns (A1, B1, C1 etc...)
How can I transform this code to select the next entry in the next column and not in the next row ?
Thank you very much for your help
Anthony
I am asking for your help for a VBA code which create new sheets from a template sheet.
I have already found and modified which works well :
Code:
<code class="hljs vbscript">Sub CreeOnglets()
Application.ScreenUpdating = False
supOnglets
Set bd = Sheets("bd")
bd.[A1].CurrentRegion.Sort Key1:=bd.Range("A2"), Order1:=xlAscending, Header:=xlGuess
ligBD = 2
Do While ligBD <= bd.[A65000].End(xlUp).Row
nom = bd.Cells(ligBD, 1) ' Premier nom
Sheets("modèle").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = "F_" & nom
Set fiche = Sheets("F_" & nom)
fiche.Range("B3").Value = nom
fiche.Range("b4").Value = bd.Cells(ligBD, "B")
ligBD = ligBD + 1
Loop
End Sub
Sub supOnglets()
Application.DisplayAlerts = False
For s = Sheets.Count To 1 Step -1
If Left(Sheets(s).Name, 2) = "F_" Then Sheets(s).Delete
Next s
End Sub
Sub exportOnglets()
CheminAppli = ThisWorkbook.Path
Application.DisplayAlerts = False
For i = 1 To Sheets.Count
If Left(Sheets(i).Name, 2) = "F_" Then
Sheets(i).Select
nonglet = ActiveSheet.Name
ActiveSheet.Copy
ActiveWorkbook.SaveAs Filename:=CheminAppli & "\" & nonglet
ActiveWindow.Close
End If
Next i
End Sub
Sub consolideOngletsBD()
ligBD = 2
Set bd = Sheets("bd")
For f = 1 To Sheets.Count
If Left(Sheets(f).Name, 2) = "F_" Then
bd.Cells(ligBD, "A") = Sheets(f).[B3]
ligBD = ligBD + 1
End If
Next f
End Sub</code>
but the problem is that with this code the new entries are organized in rows (A, A2, A3 etc...), while I need to transform it into columns (A1, B1, C1 etc...)
How can I transform this code to select the next entry in the next column and not in the next row ?
Thank you very much for your help
Anthony