ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find a Value and not a Formula (https://www.excelbanter.com/excel-programming/275384-re-find-value-not-formula.html)

kiat

Find a Value and not a Formula
 
Try the Range property Text:

if len(activecell.text) = 0 then...end if 'cell has empty string
if val(activecell.text)= 0 then...end if 'cell has zero numerical value

"Lenny Amore" wrote in message
...
Hi All,
I have a question that I hope someone can help me with.
I wrote some code that looks at a workbook for a 3 letter
month (example Jan Feb Mar, etc) and then moves one column
over. So for example when it finds the month of Jul it
moves to the value column. OK, I got that part
working...Now I want to look into that cell and find out
if there is a value there. The workbook is linked to
another so that when other people enter data it is
inserted into this workbook. Problem is that if they don't
insert their data I can't go any further so I want my code
to throw an error and say this cell is empty. The problem
is, it is looking at the formula in the cell and therefore
says the cell is not empty. I hope this isn't to
confusing. Below is my code:'Find the Cell corresponding
to current month
Range("A1").Select
Cells.Find(What:=str_month, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select

If Not IsNull(ActiveCell.Value) Then
'Keep going
'
Else
'stop Generate error message
MsgBox ("There is no FTVR Data")
End If

I would appreciate any help on this.
Thanks,
Lenny





kiat

Find a Value and not a Formula
 
ok, I don't know what kind of value your users are entering in the other
workbook, is it string or numeric?

string:
First turn display zero off: ActiveWindow.DisplayZeros = False
then this will work: If Len(Activecell.Text)=0 then 'do your error msg

numeric:
is entering 0 allowed? If not, this will work: If Val(Activecell.Value) then
'do your error msg
if entering 0 is allowed, then I haven't a solution to detect if the cell is
empty at the users' end except to go there and look at it directly.

"Lenny Amore" wrote in message
...
The problem is that the cell is linked to another spreadsheet so the is
text in there already. I need it to ignore the formula and tell me say
the value is = to 24 or there is nothing there except the formula which
I need to have ignored.

Thanks,
Lenny



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com