Option
Explicit
Sub
Sowas()
Dim
strZelle
As
String
Dim
varWert
As
Variant
Call
AlleBlätter(
"A5"
,
"Hallo"
)
Call
AlleBlätter(
"C5"
, 128.22)
Call
AlleBlätter(
"D5"
,
False
)
End
Sub
Sub
AlleBlätter(
ByVal
Zelle
As
String
, Wert
As
Variant
)
Dim
oWbk
As
Excel.Workbook
Dim
oWsh
As
Excel.Worksheet
On
Error
GoTo
AlleBlätter_Error
Set
oWbk = ThisWorkbook
For
Each
oWsh
In
oWbk.Sheets
oWsh.Range(Zelle).Value = Wert
Next
oWsh
On
Error
GoTo
0
AlleBlätter_Error:
Select
Case
Err.Number
Case
Is
= 0:
Case
Else
:
Call
MsgBox(
"keine gültige Zellbezeichnung"
, vbCritical,
"Angabe fehlerhaft"
)
End
Select
End
Sub