Option
Explicit
Private
AltSh
As
Worksheet
Private
ActSh
As
Worksheet
Private
Sub
CommandButton3_Click()
Dim
ImportDatei
As
Variant
Dim
wbImport
As
Workbook
Set
AltSh = ActiveWorkbook.Sheets(
"Alt"
)
ImportDatei = Application.GetOpenFilename _
(FileFilter:=
"Microsoft Excel-Dateien (*.xls; *.xlsx; *.xlsm),*.xls; *.xlsx; *.xlsm"
, _
Title:=
"Eine Datei auswählen"
)
If
ImportDatei =
False
Then
Exit
Sub
Application.ScreenUpdating =
False
Set
wbImport = Workbooks.Open(ImportDatei)
Cells.
Select
Selection.Copy Destination:=AltSh.Range(
"A1"
)
wbImport.Close
AltSh.
Select
Application.ScreenUpdating =
True
End
Sub
Private
Sub
CommandButton2_Click()
Dim
AltRng
As
Range
Dim
c
As
Range
Set
AltSh = ActiveWorkbook.Sheets(
"Alt"
)
Set
ActSh = ActiveWorkbook.Sheets(
"Aktuell"
)
Set
AltRng = AltSh.Range(
"A1"
).CurrentRegion
Rem ich möchte aber nur, dass die jeweiligen Zellen markiert werden
For
Each
c
In
AltRng
With
ActSh.Range(c.Address)
If
.Value <> c.Value
Then
.Interior.ColorIndex = 6
End
With
Next
c
ActSh.
Select
Range(
"A1"
).
Select
End
Sub