Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to use the following code on a column containing
formula. It works if there are just values in the range but my range has formula in it. Sub tester() For Each cell In Range("B2:B20") If cell.Value 0 Then cell.Offset(0, -1).Value = "Yes" End If Next End Sub Thanks in advance. Gareth |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code you show should work whether there are formula or not. The only
problem I can see if is the cell value is text, then you might have a problem with the if statement. Sub tester() For Each cell In Range("B2:B20") if not isempty(cell.Value) then if isnumeric(cell.Value) then If cell.Value 0 Then cell.Offset(0, -1).Value = "Yes" End if end if End If Next End Sub -- Regards, Tom Ogilvy "gareth" wrote in message ... I need to use the following code on a column containing formula. It works if there are just values in the range but my range has formula in it. Sub tester() For Each cell In Range("B2:B20") If cell.Value 0 Then cell.Offset(0, -1).Value = "Yes" End If Next End Sub Thanks in advance. Gareth |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Alt Code Problem | Excel Discussion (Misc queries) | |||
Code problem | Excel Discussion (Misc queries) | |||
vba code problem | Excel Programming | |||
Code problem | Excel Programming | |||
Code Problem ! | Excel Programming |