Thanks for looking at this one.....
when writing a macro in visual basic, how would you write code to do
something like this:
IF quot;Named Range 1quot; is not equal to quot;Named Range 2quot; THEN (do a simple
cut/copy/paste which I've allready figured out) ELSE END IF
I can do this with range as cell address (quot;A2quot;) but don,t know how to
reference the Named Range.
Thanks....
Spydor--
spydor
------------------------------------------------------------------------
spydor's Profile: www.excelforum.com/member.php...oamp;userid=28438
View this thread: www.excelforum.com/showthread...hreadid=498554I like something like:
if worksheets(quot;sheet1quot;).range(quot;NamedRange1quot;).value _
= worksheets(quot;sheet2quot;).range(quot;NamedRange2quot;).value then
'do nothing
else
worksheets(quot;sheet1quot;).range(quot;namedrange1quot;).value _
= worksheets(quot;sheet2quot;).range(quot;namedrange2quot;).value
end if
This actually just assigns the value from namedrange2 to namedrange1.
===
But I think I'd just set the values equal and get rid of the check, well, if the
situation fit.
spydor wrote:
gt;
gt; Thanks for looking at this one.....
gt;
gt; when writing a macro in visual basic, how would you write code to do
gt; something like this:
gt;
gt; IF quot;Named Range 1quot; is not equal to quot;Named Range 2quot; THEN (do a simple
gt; cut/copy/paste which I've allready figured out) ELSE END IF
gt;
gt; I can do this with range as cell address (quot;A2quot;) but don,t know how to
gt; reference the Named Range.
gt;
gt; Thanks....
gt;
gt; Spydor
gt;
gt; --
gt; spydor
gt; ------------------------------------------------------------------------
gt; spydor's Profile: www.excelforum.com/member.php...oamp;userid=28438
gt; View this thread: www.excelforum.com/showthread...hreadid=498554
--
Dave Peterson
- Mar 13 Thu 2008 20:43
Use a range name in VB with IF Then Else statement
close
全站熱搜
留言列表
發表留言
留言列表

