View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norie Norie is offline
external usenet poster
 
Posts: 82
Default How do I assign variables

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