LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Variables not showing value

Are you questioning what the Mod function does?

It's just the remainder of division.
eg.
10 divided by 3 = 3 remainder 1
10 \ 3 = 3
10 Mod 3 = 1


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Todd Huttenstine" wrote in message
...
See here is VBA examples:

MyResult = 10 Mod 5 ' Returns 0.
MyResult = 10 Mod 3 ' Returns 1.
MyResult = 12 Mod 4.3 ' Returns 0.
MyResult = 12.6 Mod 5 ' Returns 3.

I do not understand how they are getting these numbers. I can understand

10
mod 5 and even 10 Mod 3 but the other 2 do not make sense.

Also if I add all the variables to the watch screen I can see the

variables
change, but I can usually just hold my currsor over the variable itself in
the code and the value pops up. THe value is not popping up for some

reason
now.


"Todd Huttenstine" wrote in message
...
Hey I do not understand the math behind the mod thing in the code.
According to VB help, the definition for mod is as follows: Used to

divide
two numbers and return only the remainder. I am sitting here using a
calculator and I cannot figure out the answer is derived. I mean

understand
how the answer is derived logically but I cannot figure out how the math

is
done. In the example I am using I used 30 as the column index number.

and
the mod is 4. How is this?


"Rob van Gelder" wrote in

message
...
No idea about the variable watch issue, but if you're after the column
letter:

Sub test()
Dim lngColumn As Long, strColumn As String

lngColumn = 27
strColumn = Split(Columns(lngColumn).Address(, False), ":")(1)
MsgBox strColumn
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Todd Huttenstine" wrote in message
...
In run mode when you are pressing F8 to run each line of code line

by
line
you can usually hold your curssor over a variable and it show you

the
value.
Well why is it not doing that on the following code? I got this

code
off
of
http://www.rb-ad.dircon.co.uk/rob/ex...tips/index.htm

Dim intTemp As Integer
Dim intInt As Integer
Dim intMod As Integer
Dim column_number
Dim COLUMN_LETTER


column_number = Worksheets("Sheet1").Range("A10").Value

' return error if column number is not a number
'If Not IsNumeric(column_number) Then _
' COLUMN_LETTER = CVErr(xlErrRef): Exit Function

' if column number is a range then only consider
' the first cell in the range
If TypeName(column_number) = "Range" Then
If column_number.Cells.Count 1 Then _
intTemp = column_number.Cells(1, 1).Column _
Else intTemp = column_number.Column
Else
intTemp = column_number
End If

' if column number is illegal then return an error
'If intTemp 256 Or intTemp < 1 Then _
' COLUMN_LETTER = CVErr(xlErrRef): Exit Function

' divide column number by 26. Remainder
' is the second letter
intMod = intTemp Mod 26

' if no remainder then fix value
If intMod = 0 Then
intMod = 26
intTemp = intTemp - 26
End If

' first letter
intInt = intTemp \ 26

' put it together
If intInt = 0 Then _
COLUMN_LETTER = Chr(intMod + 64) Else _
COLUMN_LETTER = Chr(intInt + 64) & Chr(intMod + 64)
MsgBox COLUMN_LETTER
MsgBox column_number











 
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
How to fix my spreadsheet from showing formula to showing answer SimplyQuick Excel Discussion (Misc queries) 4 October 7th 08 10:00 PM
How to fix my spreadsheet from showing formula to showing answer SimplyQuick Excel Discussion (Misc queries) 0 October 7th 08 06:38 PM
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
showing lookup result with multiple variables jprice Excel Discussion (Misc queries) 2 July 12th 06 12:50 AM
Showing/ not showing "getting started" when excel starts Ask Excel Discussion (Misc queries) 1 July 20th 05 04:20 PM


All times are GMT +1. The time now is 11:53 PM.

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

About Us

"It's about Microsoft Excel"