Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

DATENFELD!!!!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christian Egger - 24 Jan 2005 15:07 GMT
Liebe Experten,

Ganz einfache Frage zu VBA:

Wenn ich eine Variable x habe und x = 3 und
ich will x UM 4 erh?hen, sgae ich:

x = x + 4

Wie mache ich dasselbe bei einem Datenfeld, zB
Dim feld (1 To 10) As Integer
feld(1) = 1
feld(2) = 2........................

Wie kann ich alle Variablen von (1-10)
um 4 erh?hen OHNE sie in eine For...Next
Schleife einzubinden?
feld(1 To 10) = feld (1 To 10) + 4 funktioniert nicht.

Besten Dank f?r Eure Hilfe!
Christian
Helmut Weber - 24 Jan 2005 16:06 GMT
Hi Christian,
I'd try

microsoft.public.de.word.vba

Greetings from Bavaria, Germany
Ich will hier nicht weiter in Deutsch anworten.
Kommt mir für die Mitlesern unhöflich vor.

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Andi Mayer - 24 Jan 2005 16:39 GMT
>Wie kann ich alle Variablen von (1-10)
>um 4 erhöhen OHNE sie in eine For...Next
>Schleife einzubinden?
>feld(1 To 10) = feld (1 To 10) + 4 funktioniert nicht.

meines wissens Nein

schreib dir eine Function (sub)

Sub erhöheAry(ary As Variant, Nr As Long)
Dim I As Long
For I = LBound(ary) To UBound(ary)
   ary(I) = ary(I) + Nr
Next I
End Sub

dann gehts mit:

erhöheAry(feld,4)
---
If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
Helmut Weber - 24 Jan 2005 17:01 GMT
Hi Christian,
don't shot! All CAPITALS!
Hi both of you,
got some kind of humour?

Sub Makro19()
Dim l As Long
Dim Feld(1 To 10) As Long
For l = 1 To 10
  Feld(l) = l
Next
l = 0
' without using "for" ;-)
While l < 10
  l = l + 1
  Feld(l) = l + 4
  Debug.Print Feld(l)
Wend
End Sub

Another way would be:
feld(1) = feld(1) + 4
feld(2) = feld(2) + 4
...
lol

Cheers

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Helmut Weber - 24 Jan 2005 17:29 GMT
HI CHRISTIAN,
DON'T SHOUT. (not shot)
HW
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.