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

Hi. I'm new to VBA and wrote this code to calculate pay. It's working but
what I also need is to have calculations done by taking the data and adding
them and then dividing them. I wanted to assign varibles to the IF
statements to allow me make the addition and division easier but its not
working. How do I assign variables to allow me to add and divide? Here is
the code. Thank you in advance.

Sub calculate_retropay()

Dim paycode12 As Integer
Dim paycode13 As Integer
Dim paycode1E As Integer
Dim paycode1H As Integer
Dim paycode1I As Integer
Dim paycode1J As Integer
Dim paycode1 As Integer

'this will search for the pay period in column C
Enterpp = InputBox("Please enter the period number ie 2008-21-0")
finalrow = Cells(65536, 3).End(xlUp).Row
finalrow1 = Cells(65536, 6).End(xlUp).Row

For i = 1 To finalrow
For j = 1 To finalrow1


'takes the value of what pay period is keyed in
If Cells(i, 3).Value = Enterpp Then
'if paycode =1 then take the new rate * by hours
If Cells(j, 6).Value = 1 Then
paycode1=Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)
***when I assign this as a variable it doesn't work
Else
If Cells(j, 6).Value = 5 Then
Cells(j, 12).Value = "test" ** if its set like this
when it works fine
Else
if paycode =12 then take the new rate * by hours
If Cells(j, 6).Value = 12 Then
Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)


 
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 01:55 AM.

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"