Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default The most basic question ever - what does "i" mean

i is a variable. The name was Bill's choice--almost arbitrary. He wouldn't use
a variable named Long, Integer, Row, Font, Bold or any thing built into excel's
VBA--or any illegal name (VBA's help will explain more).

In this case, I bet Bill has a line like:
Dim i As Long
(or "Dim i as integer")
in his code

In this case, it's a place holder that he can use for looping between the number
1 and the number that's stored in that FinalRow (another variable).

So for the first time through (when i = 1):
Range ("A" & 1 & ":E" & 1).Font.Bold = True
which is:
Range ("A1":E1").Font.Bold = True

The 2nd time through, i = 2:
Range ("A" & 2 & ":E" & 2).Font.Bold = True
which is:
Range ("A2":E2").Font.Bold = True

If he had 1000 rows to bold, it would be very ugly to use 1000 lines like:

Range ("A1":E1").Font.Bold = True
Range ("A2":E2").Font.Bold = True
Range ("A3":E3").Font.Bold = True
Range ("A4":E4").Font.Bold = True
...
Range ("A1000":E1000").Font.Bold = True


jknapp1005 wrote:

Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default The most basic question ever - what does "i" mean

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.



iterator - a variable which changes its value (usually by 1) in every
iteration of the loop.
"i" was the simplest what could be chosen to name iterator


check also Hungarian notation.
It has something to do with International Space Station :)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default The most basic question ever - what does "i" mean

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.




I found one: http://mathworld.wolfram.com/i.html

The code is complex.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default The most basic question ever - what does "i" mean

smartin wrote:

without explaining what the heck "i" means. Try searching for the
meaning of "i" in any database.



I found one: http://mathworld.wolfram.com/i.html

The code is complex.

O yes, it is really about complex numbers.


:)


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default The most basic question ever - what does "i" mean


"smartin" wrote in message
...
jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All
the sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning
of "i" in any database.


I found one: http://mathworld.wolfram.com/i.html

The code is complex.


Are you NUTS? I is a variable to hold an integer value. Why make something
complex out of it?


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default The most basic question ever - what does "i" mean

witek wrote:
smartin wrote:

without explaining what the heck "i" means. Try searching for the
meaning of "i" in any database.



I found one: http://mathworld.wolfram.com/i.html

The code is complex.

O yes, it is really about complex numbers.


:)


Actually, the code is imaginary. There can be no "FinalRow" because
there is always one more row. This concept has been demonstrated many
times. For a perfect example you can read this:
http://mathschallenge.net/index.php?...nfinite_primes
but this is a much more succinct proof:

If we write
For i = 1 to FinalRow
...
Next i

It is the same as
i = 1
While i <= FinalRow ' Note 1
...
i = i + 1 ' Note 2
Wend

Note 1: Aha! i is the duck that eats i + 1, so i always gets bigger
[especially when cheeseburgers are nearby], so FinalRow must be a
nondecreasing function of i. Therefore as i go, you go.

Note 2: Now, how can i = i + 1, really ??? There are only two
possibilities: either FinalRow is unbound, so either i = infinity, or
1=2. I think the latter can be proved, but I've lost my notes on that
one. So the former must be true. However if you have so many rows that
Excel craps out, you have a cheeseburger, and then the next row is
imagined: QED.
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default The most basic question ever - what does "i" mean

measekite's psychiatrist wrote:
"smartin" wrote in message
...
jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All
the sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning
of "i" in any database.

I found one: http://mathworld.wolfram.com/i.html

The code is complex.


Are you NUTS? I is a variable to hold an integer value. Why make something
complex out of it?



You're the psychiatrist (^:

I eat almonds.

You are what you eat.

Therefore...
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default The most basic question ever - what does "i" mean

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.


Ok I've had my fun with your missive and departed from my usual habit of
not baiting rhetorical (trollish) posts. Others have given some very
sane and reasonable explanations for the meaning of "i" in the context
of your post (even though you didn't ask for that). I hope they made sense.

jknapp1005, If you spent any time at all looking at code--in any
language--you will encounter "i" as it is commonly used, as the saner
posters described, as a generic looping variable.

To the point: I suggest you engage in a couple minutes of independent
study to make sure you are not overlooking the obvious before attacking
anyone. If the concept still doesn't make sense, ask a reasonable
question, not a rhetorical (trollish) one.
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

Sorry, smartin, not meaning to be trollish. Actually, I DID spend a good hour
trying to find some definition of "i". It may seem obvious to you folks, but
as someone who is fairly new, it is isn't really obvious to me. I do realize
to those who are experienced, it would seem like a basic question. But I
looked in the index, online, in the VBA editor window, and couldn't find
anything that described it. I even referenced other's books, and didn't see
it being used.

Yeah, sometimes the most basic things do escape me. Thanks for posting.

"smartin" wrote:

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.


Ok I've had my fun with your missive and departed from my usual habit of
not baiting rhetorical (trollish) posts. Others have given some very
sane and reasonable explanations for the meaning of "i" in the context
of your post (even though you didn't ask for that). I hope they made sense.

jknapp1005, If you spent any time at all looking at code--in any
language--you will encounter "i" as it is commonly used, as the saner
posters described, as a generic looping variable.

To the point: I suggest you engage in a couple minutes of independent
study to make sure you are not overlooking the obvious before attacking
anyone. If the concept still doesn't make sense, ask a reasonable
question, not a rhetorical (trollish) one.



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

That's a very good answer. Thank you very much.

"smartin" wrote:

witek wrote:
smartin wrote:

without explaining what the heck "i" means. Try searching for the
meaning of "i" in any database.



I found one: http://mathworld.wolfram.com/i.html

The code is complex.

O yes, it is really about complex numbers.


:)


Actually, the code is imaginary. There can be no "FinalRow" because
there is always one more row. This concept has been demonstrated many
times. For a perfect example you can read this:
http://mathschallenge.net/index.php?...nfinite_primes
but this is a much more succinct proof:

If we write
For i = 1 to FinalRow
...
Next i

It is the same as
i = 1
While i <= FinalRow ' Note 1
...
i = i + 1 ' Note 2
Wend

Note 1: Aha! i is the duck that eats i + 1, so i always gets bigger
[especially when cheeseburgers are nearby], so FinalRow must be a
nondecreasing function of i. Therefore as i go, you go.

Note 2: Now, how can i = i + 1, really ??? There are only two
possibilities: either FinalRow is unbound, so either i = infinity, or
1=2. I think the latter can be proved, but I've lost my notes on that
one. So the former must be true. However if you have so many rows that
Excel craps out, you have a cheeseburger, and then the next row is
imagined: QED.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

That's really great, actually. I couldn't find anything like that. Although
you guys are having fun takin' shots (which I'm sure I deserve), I actually
learned something from that. Thanks.

"smartin" wrote:

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.




I found one: http://mathworld.wolfram.com/i.html

The code is complex.


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

Thanks. Very helpful.

"witek" wrote:

jknapp1005 wrote:
Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.



iterator - a variable which changes its value (usually by 1) in every
iteration of the loop.
"i" was the simplest what could be chosen to name iterator


check also Hungarian notation.
It has something to do with International Space Station :)




  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default The most basic question ever - what does "i" mean

Thanks, Dave. You were much gentler on me than I probably deserved. Sometimes
the simplest things are the most frustrating (for me anyway). Thanks very
much!

"Dave Peterson" wrote:

i is a variable. The name was Bill's choice--almost arbitrary. He wouldn't use
a variable named Long, Integer, Row, Font, Bold or any thing built into excel's
VBA--or any illegal name (VBA's help will explain more).

In this case, I bet Bill has a line like:
Dim i As Long
(or "Dim i as integer")
in his code

In this case, it's a place holder that he can use for looping between the number
1 and the number that's stored in that FinalRow (another variable).

So for the first time through (when i = 1):
Range ("A" & 1 & ":E" & 1).Font.Bold = True
which is:
Range ("A1":E1").Font.Bold = True

The 2nd time through, i = 2:
Range ("A" & 2 & ":E" & 2).Font.Bold = True
which is:
Range ("A2":E2").Font.Bold = True

If he had 1000 rows to bold, it would be very ugly to use 1000 lines like:

Range ("A1":E1").Font.Bold = True
Range ("A2":E2").Font.Bold = True
Range ("A3":E3").Font.Bold = True
Range ("A4":E4").Font.Bold = True
...
Range ("A1000":E1000").Font.Bold = True


jknapp1005 wrote:

Bill Jelen wrote a book for VBA in Excel 2007. I guess he thinks I know
everything. He is writing things and not explaining what they are. All the
sudden he's writing section of macros that say things like:

FinalRow = Cells(Rows.Count, 1). End(xlUp).Row
For i = 1 to FinalRow
Range ("A" & i & ":E" & i).Font.Bold = True
Next i

without explaining what the heck "i" means. Try searching for the meaning of
"i" in any database.


--

Dave Peterson

  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default The most basic question ever - what does "i" mean

jknapp1005 wrote:
Sorry, smartin, not meaning to be trollish. Actually, I DID spend a good hour
trying to find some definition of "i". It may seem obvious to you folks, but
as someone who is fairly new, it is isn't really obvious to me. I do realize
to those who are experienced, it would seem like a basic question. But I
looked in the index, online, in the VBA editor window, and couldn't find
anything that described it. I even referenced other's books, and didn't see
it being used.

Yeah, sometimes the most basic things do escape me. Thanks for posting.


Ok, I am glad to know you were not just trolling. Hope there are no hard
feelings.

Was your question answered?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make a "tab name" the "chart title"? (question on this) [email protected] Charts and Charting in Excel 2 April 15th 09 06:26 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
"Disk is Full" add-on question to "Can't reset last cell" post tod [email protected] Excel Discussion (Misc queries) 0 January 22nd 07 02:32 AM
Question on determining "ROW" inside of a "For .. RANGE " loop David Schrader[_2_] Excel Programming 2 January 3rd 07 08:18 PM
Validation question - allow -500%, 0%, "=50%*50%" but forbid "A", "", " ", "-" ? tskogstrom Excel Programming 2 November 27th 06 09:50 AM


All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"