Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cells E3, I3, J3, and K3 are ideally formatted as percent for ease of
interpretation by users, however this creates a difficulty with the value of K3 seen as "1" in the VBA code. Even though for example by comparrisson the value of E3 on the spread sheet is 62% and is seen in the VBA coce as 0.62 I can not see what is out of order. I have tried refromatting the cell K3, using a different cell, but no matter what I have tried I continue to see the vlaue of cell K3 (55%) from the spreadsheet being seen as "1" within the VBA code, which of course stops one section of the code from activating. Any help would be appreciated, See code below! Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Dim ThsWk, LstWk, Avg, Trgt, Lb, Ub, Ooc As Long 'get variable values ThsWk = Worksheets("Sheet1").Range("E3").Value Lb = Worksheets("Sheet1").Range("I3").Value Ub = Worksheets("Sheet1").Range("J3").Value Ooc = Worksheets("Sheet1").Range("K3").Value ' test variable cases If ThsWk Ooc Then With Worksheets("Sheet1").Range("C3").Value Worksheets("Sheet1").Range("C3").Font.Name = "arial" Worksheets("Sheet1").Range("C3").Value = "©" Worksheets("Sheet1").Range("C3").Interior.ColorInd ex = 3 End With End If If ThsWk Ub And ThsWk < Ooc Then With Worksheets("Sheet1").Range("C3").Value = "what?" Worksheets("Sheet1").Range("C3").Value = "" Worksheets("Sheet1").Range("C3").Font.Name = "arial" Worksheets("Sheet1").Range("C3").Interior.ColorInd ex = 3 End With End If If ThsWk < Ub And ThsWk Lb Then With Worksheets("Sheet1").Range("C3") Worksheets("Sheet1").Range("C3").Value = "" Worksheets("Sheet1").Range("C3").Font.Name = "arial" Worksheets("Sheet1").Range("C3").Interior.ColorInd ex = 6 End With End If If ThsWk < Lb Then With Worksheets("Sheet1").Range("C3").Value Worksheets("Sheet1").Range("C3").Value = "" Worksheets("Sheet1").Range("C3").Font.Name = "arial" Worksheets("Sheet1").Range("C3").Interior.ColorInd ex = 4 End With End If End Sub -- hippy |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
adding a percentage for COLA to Payroll worksheet | Excel Worksheet Functions | |||
Difficulty with IMPOWER() Worksheet Function | Excel Worksheet Functions | |||
How do I apply icon sets to percentage values in Excel worksheet? | Excel Worksheet Functions | |||
how to copy same percentage to complete worksheet | Excel Worksheet Functions | |||
Increase excel worksheet vlaues by a percentage | Excel Worksheet Functions |