Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When I try to get the value from the variable its a zero. Does anyone know
why? "KevinM" wrote in message ... Nori: Hi. I didn't know if these variables were necessary. I do know however I did need some kind of variables because later in the VBA program I need to take the results and add then divide certain paycodes. I'm open to any suggestions because I'm new at this and just read resource books on VBA and went with it. Thanks again for the help. "norie" wrote in message ... Kevin Why do you have all these variables? Why all the if statements? I really think you need to look into both of these - for a start you appear to be giving the same value to multiple variables and perhaps you could use Select Case instead of all those Ifs. Perhaps something like this for the start of the code, I didn't go through it all - my fingers were starting to hurt.:) Select Case Cells(j, 6).Value Case 1, 12, 13 Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1E" paycode1E = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1H" paycode1H = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1I" paycode1I = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1J" paycode1J = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1M" paycode1M = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1V" paycode1V = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "1N" paycode1N = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11) Case "7B" earnings7b = Cells(j, 10) Case "7C" earnings7C = Cells(j, 10) Case "7D" earnings7D = Cells(j, 10) Case "7E" earnings7E = Cells(j, 10) Case "7M" earnings7M = Cells(j, 10) Case "7Q" earnings7Q = Cells(j, 10) Case "7S" earnings7S = Cells(j, 10) Case "7Z" earnings7Z = Cells(j, 10) Case "99" earnings99 = Cells(j, 10) Case "9A" earnings9A = Cells(j, 10) Case "9B" earnings9B = Cells(j, 10) Case "9C" earnings9C = Cells(j, 10) Case "9D" earnings9D = Cells(j, 10) Case "9F" earnings9F = Cells(j, 10) Case "9G" earnings9G = Cells(j, 10) Case "9H" earnings9H = Cells(j, 10) Case "9L" earnings9L = Cells(j, 10) Case "9O" earnings9O = Cells(j, 10) Case "9P" earnings9P = Cells(j, 10) Case "9S" earnings9S = Cells(j, 10) Case "9T" earnings9T = Cells(j, 10) Case "9U" earnings9U = Cells(j, 10) End Select |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
Storing variables in a macro and using those variables to performcalculations. | Excel Programming | |||
Assign different | Excel Programming | |||
assign | Excel Discussion (Misc queries) | |||
Assign a variables value to a TextBox | Excel Programming |