I'm new to VBA and created this code.  Its working but when I attempt
to assign a variable then it doesn't calculate.  Here is a snippit of
the code.  The variable is 'paycode12'.  When I just have it as  Cells
(j, 12).Formula = Cells(j, 7) * Cells(j, 11) this format it works
fine.



Any help is appreciated.

KevinM

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

    '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

    Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)

    Else

    'if paycode =12 then take the new rate * by hours

    If Cells(j, 6).Value = 12 Then

    paycode12 = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)

    Else

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 5,200 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to