Gruppe
Format
Problem
Die Spalten dieser Tabelle sollen gemäß den Zahlenformat-Vorgaben aus Tabelle "Formate" formatiert werden.
StandardModule: basMain
Sub Formatieren()
Dim wks As Worksheet
Dim iCol As Integer
Dim sCol As String
Dim sTxt As String
Set wks = Worksheets("Formate")
iCol = 1
Do Until IsEmpty(wks.Cells(1, iCol))
sTxt = wks.Cells(2, iCol)
Do Until InStr(sTxt, ",") = 0
sCol = Left(sTxt, InStr(sTxt, ",") - 1)
Columns(CInt(sCol)).NumberFormat = wks.Cells(1, iCol).Value
sTxt = Right(sTxt, Len(sTxt) - InStr(sTxt, ","))
Loop
Columns(CInt(sTxt)).NumberFormat = wks.Cells(1, iCol).Value
iCol = iCol + 1
Loop
End Sub