Rouven: VB-Script und Excel Button

Beitrag lesen

Hello,

Sub CommandButton1_Click()

OK

InputBox

bitte die Parameter nachschlagen, hatte ich verlinkt, dann
Dim neuerName As String
neuerName = InputBox(...)

ThisWorkbook.Worksheets(Haupt).Copy Position

  • Der Name ist keine Variable, sondern muss in Anführungszeichen stehen: ("Haupt")
  • Weiterhin hättest du folgendes Beispiel auf der verlinkten Seite gefunden:
    Copy method as it applies to the Chart, Charts, Sheets, Worksheet, and Worksheets objects.Copy method as it applies to the Chart, Charts, Sheets, Worksheet, and Worksheets objects.
    This example copies Sheet1, placing the copy after Sheet3.
    Worksheets("Sheet1").Copy After:=Worksheets("Sheet3")

ThisWorkbook.Worksheets(copy of Haupt).Name = xxx

  • copy of haupt ist ungültige Syntax. Setzes es in Anführungszeichen ("Copy of Haupt") - das wird bei deutschen Excel-Versionen allerdings u.U. ein Problem (-> nachgucken)
  • xxx ersetzt du durch die Variable von oben (neuerName)

End Sub

MfG
Rouven

--
-------------------
Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends: commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for working long hours but are rarely credited with being driven by creative fevers. Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination, but because their imagination reveals worlds that others cannot see. -- Larry OBrien and Bruce Eckel in Thinking in C#