View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
TUNGANA KURMA RAJU TUNGANA KURMA RAJU is offline
external usenet poster
 
Posts: 171
Default search a value in W/sheet

Thank you Dave,activate Commandbutton means,the button should be enabled.
Dave,can you please amend this code,
If empty cell found in rande D:D range ,commandbutton1 caption should be
"OUT" else commandbutton caption be "IN"
"Dave Peterson" wrote:

Dim res as variant
dim myRng as range
with worksheets("Somesheetnamehere")
set myrng = .range("a1:A99") 'your list
end with

res = application.match(me.textbox1.value, myrng, 0)

me.commandbutton1.enabled = false

if iserror(res) then
'no match between the textbox and the range
else
if isempty(myrng(res).offset(0,3).value) then
me.commandbutton1.enabled = true
'me.commandbutton1.setfocus '????
end if
end if

Untested, uncompiled. Watch for typos.

And I'm not sure what activate a commandbutton means.

TUNGANA KURMA RAJU wrote:

I have 4 columns data on my w/sheet.
my userform has textbox in which a value entered.
I need code for:
match the value with w/sheet Col A:A and find which corresponding Col D:D
cell is empty,if empty, activate a commandbutton on userform.
thanks...


--

Dave Peterson