View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
KevinM[_2_] KevinM[_2_] is offline
external usenet poster
 
Posts: 9
Default Unable to view variable

Thanks Joel. I still get a zero value. Let me back up a bit. Here is the
code I'm using that's using variable "paycode12". I get no error when I run
it but its not giving me the value stored in these variables. If you can
assist me on getting the value out of these variables. I really appreciate
the help. Thanks in advance.


Sub retropay2()

Dim paycode12 As Long
Dim paycode13 As Integer
Dim paycode1E As Integer
Dim paycode1H As Integer
Dim paycode1I As Integer
Dim paycode1J As Integer
Dim paycode1 As Integer
Worksheets("flx00012.tmp").Activate
finalrow1 = Cells(65536, 6).End(xlUp).Row
For j = 1 To finalrow1

'this will see if j,6 is equal to paycode 1,12,13
Select Case Cells(j, 6).Value
Case 1
paycode1=Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)
Case 12
paycode12 = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)

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

'this will look at paycode 1E 1H in j,6
Case "1E"
paycode1E = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)
Case "1H"
payrcode1H = Cells(j, 12).Formula = Cells(j, 7) * Cells(j, 11)

End Select
Next j
End Sub




"Joel" wrote in message
...
You may have more than one workbook opened. See if this helps

Sub SetVarFromCell()
Dim paycode12 As Long


MsgBox (ThisWorkbook.Name & " " & ActiveSheet.Name & " " &
ActiveCell.Address)
MsgBox (ActiveCell.Value)
with Thisworkbook
paycode12 = .Worksheets("flx00012.tmp").Cells(18, "L").Value
end with
MsgBox (paycode12)


End Sub


"KevinM" wrote:

I'm unable to get the value stored in the variable. I'm not sure what
I'm
doing wrong. I get a value of zero. Here's what I'm doing to check the
value of the data:

Sub SetVarFromCell()
Dim paycode12 As Long


MsgBox (ThisWorkbook.Name & " " & ActiveSheet.Name & " " &
ActiveCell.Address)
MsgBox (ActiveCell.Value)
paycode12 = Worksheets("flx00012.tmp").Cells(18, "L").Value
MsgBox (paycode12)


End Sub


Any help is appreciated.