Sub Unico()
'
' SUN Macro
' Macro recorded 08/08/2012 by IT058688
'
'
Dim i As Integer
Dim CurRange As Range
Dim wbk_dest As Workbook
Set CurRange = Range("A2:S50")
For i = 1 To CurRange.Rows.Count
If Not CurRange.Cells(i, 2) = "" Then
' ciclo di case per decidere quale file utilizzare.
CurRange.Range("A" & i).Select
Select Case CurRange.Range("A" & i)
Case "AIX"
If CurRange.Cells(i, "C") = "Tester" Then
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_AIX_RW.xls")
Else
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_AIX_RW.xls.xls")
End If
Call CommonManag(i, wbk_dest, CurRange)
Case "SUN"
If CurRange.Cells(i, "C") = "Tester" Then
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_SUN_RW.xls xls")
Else
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_SUN_R.xls ")
End If
Call CommonManag(i, wbk_dest, CurRange)
Case "TRUE64"
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_TRUE64.xls")
Call CommonManag(i, wbk_dest, CurRange)
Case "LINUX"
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_LINUX.xls")
Call CommonManag(i, wbk_dest, CurRange)
Case "HP_UX"
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippoACC_HP-UX.xls")
Call CommonManag(i, wbk_dest, CurRange)
' Inizio Case UAR
Case "UAR"
Set wbk_dest = Workbooks.Open("C:steveGrpAccountpippo TracACC3.xls")
' Gestione Nome
Windows("Lista_login.xls").Activate
CurRange.Range("B" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D5").Select
ActiveSheet.Paste
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
' Fine Gestione Nome
' Gestione Cognome
Windows("Lista_login.xls").Activate
CurRange.Range("D" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D6").Select
ActiveSheet.Paste
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
' Fine Gestione Cognome
' Gestione Data Inizio or Data start
Windows("Lista_login.xls").Activate
CurRange.Range("M" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D7").Select
ActiveSheet.Paste
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
' Fine Gestione Data Inizio or Data start
' Gestione Data Fine or Data end
Windows("Lista_login.xls").Activate
CurRange.Range("Q" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D8").Select
ActiveSheet.Paste
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
' Fine Gestione Data fine or Data end
' Gestione OBS
Windows("Lista_login.xls").Activate
CurRange.Range("F" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D12").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveWindow.SmallScroll Down:=9
' Fine Gestione OBS
' Gestione Sotto Sistema
Windows("Lista_login.xls").Activate
CurRange.Range("P" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D13").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
ActiveWindow.SmallScroll Down:=3
' Fine Gestione Sotto Sistema
' Gestione Environment
Windows("Lista_login.xls").Activate
CurRange.Range("N" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D15").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
' Fine Gestione Environment
' Gestione Diritti di scrittura
Windows("Lista_login.xls").Activate
CurRange.Range("N" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D16").Select
If CurRange.Cells(i, "C") = "Tester" Then
wbk_dest.ActiveSheet.Cells(16, "D").Value = "Read/Write"
Else
wbk_dest.ActiveSheet.Cells(16, "D").Value = "Read"
End If
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
' Fine Gestione Diritti di scrittura
' Gestione OS/Oracle
Windows("Lista_login.xls").Activate
CurRange.Range("S" & i).Select
Selection.Copy
Windows("UAR3.xls").Activate
Range("D17").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
' Fine Gestione OS/Oracle
' Gestione OS / Oracle
' Windows("Lista_login.xls").Activate
' CurRange.Range("S" & i).Select
If CurRange.Cells(i, "S") = "Oracle" Then
' Gestione Cancellazione commento
Range("D18").Select
Selection.ClearContents
Range("D19").Select
Selection.ClearContents
' Fine Cancellazione commento
' Gestione inserimento nomi DB
Windows("Lista_login.xls").Activate
CurRange.Range("R" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D21").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
' Fine Gestione DB
Else
' Gestione Server
Windows("Lista_login.xls").Activate
CurRange.Range("J" & i).Select
Selection.Copy
Windows("UAR3.xls").Activate
Range("D19").Select
ActiveSheet.Paste
Selection.Font.ColorIndex = 3
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
Range("D21").Select
ActiveCell.FormulaR1C1 = " "
With ActiveCell.Characters(Start:=1, Length:=1).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
' Fine Gestione Server
End If
' Gestione Bordo
Range("D5:D22").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
' Fine Gestione Bordo
' Gestione salvataggio file UAR
ChDir " C:steveGrp AccountNewServers"
Windows("Lista_login.xls").Activate
CurRange.Range("K" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Application.CutCopyMode = False
Windows("Lista_login.xls").Activate
CurRange.Range("K" & i).Select
'ActiveCell.FormulaR1C1 = "Abt_Ang"
Windows("UAR3.xls").Activate
ActiveWorkbook.SaveAs Filename:= _
" C:steveGrp AccountNewServersdiprova" & CurRange.Cells(i, "K") & "_UAR3.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
' Fine Gestione salvataggio file UAR
' fine case UAR
End Select
Else
Exit For
End If
Next
End Sub
Sub CommonManag(i As Integer, wbk_dest As Workbook, CurRange As Range)
' Fine Copia del file in un file anonimo
' inizio inserimento dati,
' Gestione nome
Windows("Lista_login.xls").Activate
CurRange.Range("B" & i).Select
Selection.Copy
wbk_dest.Activate
Range("D18:F18").Select
ActiveSheet.Paste
' Fine Gestione Nome
' Gestione Cognome
Windows("Lista_login.xls").Activate
CurRange.Range("D" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D19:F19").Select
ActiveSheet.Paste
' Fine Gestione Cognome
' Gestione Mail Address
Windows("Lista_login.xls").Activate
CurRange.Range("E" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D20:F20").Select
ActiveSheet.Paste
' Fine Gestione Mail Address
' Gestione OBS
Windows("Lista_login.xls").Activate
CurRange.Range("F" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D21:F21").Select
ActiveSheet.Paste
' Fine Gestione OBS
' Gestione login
ActiveWindow.SmallScroll Down:=12
Windows("Lista_login.xls").Activate
CurRange.Range("G" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D29:F29").Select
ActiveSheet.Paste
' Gestione login
' Gestione Primary Group
Windows("Lista_login.xls").Activate
CurRange.Range("H" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D30:F30").Select
ActiveSheet.Paste
' Fine Gestione Primary Group
' Gestione homedir
Windows("Lista_login.xls").Activate
CurRange.Range("I" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D34:F34").Select
ActiveSheet.Paste
' Fine Gestione homedir
' Gestione Server Name
ActiveWindow.SmallScroll Down:=12
Windows("Lista_login.xls").Activate
CurRange.Range("N" & i).Select
Select Case Env
Case "PROD"
CurRange.Range("J" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D50:J500").Select
ActiveSheet.Paste
Case "Pre"
CurRange.Range("J" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D51:J51").Select
ActiveSheet.Paste
Case "DEV"
CurRange.Range("J" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D52:J52").Select
ActiveSheet.Paste
Case "TEST"
CurRange.Range("J" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D52:J52").Select
ActiveSheet.Paste
Case "VD"
CurRange.Range("J" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Range("D53:J53").Select
ActiveSheet.Paste
End Select
' Gestione Server Name
' Gestione salvataggio
ActiveWindow.SmallScroll Down:=-27
Range("B9:J10").Select
Windows("Lista_login.xls").Activate
CurRange.Range("K" & i).Select
Application.CutCopyMode = False
Selection.Copy
wbk_dest.Activate
Application.CutCopyMode = False
Windows("Lista_login.xls").Activate
CurRange.Range("K" & i).Select
wbk_dest.Activate
ActiveWorkbook.SaveAs Filename:= _
" C:steveGrp AccountNewServersdiprova" & CurRange.Cells(i, "K") & "_" & CurRange.Cells(i, "A") & ".xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.Close
' Fine Gestione Salvataggio
Windows("Lista_login.xls").Activate
End Sub
|