I wrote a macro for opening an excel file in an existing excel. But i cant copying the formats.
Can anyone help me, how can i copy the formats? i guess, it's easy, but i can't do it.
It's really important:)
Can anyone help me, how can i copy the formats? i guess, it's easy, but i can't do it.
It's really important:)
Code:
Sub Megnyit()
Dim mf1 As Workbook
Dim mf2 As Workbook
Dim mlap As Worksheet
Dim PasteStart As Range
Set mf1 = ActiveWorkbook
Set PasteStart = [1!A1]
Sheets("1").Select
Cells.Select
Selection.ClearContents
FileToOpen = Application.GetOpenFilename _
(Title:="Please choose a Report to Parse", _
FileFilter:="Report Files *.xls (*.xls),")
If FileToOpen = False Then
MsgBox "Nincs fájl kiválasztva!", vbExclamation, "ERROR"
Exit Sub
Else
Set mf2 = Workbooks.Open(Filename:=FileToOpen)
For Each mlap In mf2.Sheets
With mlap.UsedRange
.Copy PasteStart
Set PasteStart = PasteStart.Offset(.Rows.Count)
End With
Next mlap
End If
mf2.Close
End Sub