Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to view variable
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to view variable
I placed value of 10 in cell L18 and your variable returned 10. So begs the
question, have you got a value 0 in cell L18 in specified worksheet? -- jb "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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to view variable
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to view variable
Yes, the value is greater than zero. Thank you.
"john" wrote in message ... I placed value of 10 in cell L18 and your variable returned 10. So begs the question, have you got a value 0 in cell L18 in specified worksheet? -- jb "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. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to view variable
These changes should work
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 Dim finalrow1 As Long With Worksheets("flx00012.tmp") 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, 7) * .Cells(j, 11) .Cells(j, 12) = paycode1 Case 12 paycode12 = .Cells(j, 7) * .Cells(j, 11) .Cells(j, 12) = paycode12 Case 13 paycode13 = .Cells(j, 7) * .Cells(j, 11) .Cells(j, 12) = paycode13 'this will look at paycode 1E 1H in j,6 Case "1E" paycode1E = .Cells(j, 7) * .Cells(j, 11) .Cells(j, 12) = paycode1E Case "1H" payrcode1H = .Cells(j, 7) * .Cells(j, 11) .Cells(j, 12) = payrcode1H End Select Next j End With End Sub "KevinM" wrote: 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unable to view column A in spreadsheet | Excel Discussion (Misc queries) | |||
Unable to view document | Excel Discussion (Misc queries) | |||
Unable to view any charts in new worksheet | Charts and Charting in Excel | |||
Unable to View Sheets in Workbook | Excel Discussion (Misc queries) | |||
am unable to view or use sheet tabs | New Users to Excel |