Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default How do I assign variables

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
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
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
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
Assign different gabch[_41_] Excel Programming 0 August 8th 06 12:31 PM
assign jeremy via OfficeKB.com Excel Discussion (Misc queries) 7 June 8th 05 04:12 PM
Assign a variables value to a TextBox ed Excel Programming 1 October 25th 03 08:41 PM


All times are GMT +1. The time now is 02:34 AM.

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"