close

I am using a macro to validate a form. I would like cell A1 to equate to the
last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
should have the value 4k00. I would be grateful if you could provide this to
me in VBA code.

Thanks

--
Message posted via OfficeKB.com
www.officekb.com/Uwe/Forums.a...excel/200605/1

Range(quot;A1quot;).Value = Right(Range(quot;A4quot;).Value,4)

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

quot;mohd21uk via OfficeKB.comquot; lt;u20517@uwegt; wrote in message
news:60615dea026f3@uwe...
gt; I am using a macro to validate a form. I would like cell A1 to equate to
the
gt; last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
gt; should have the value 4k00. I would be grateful if you could provide this
to
gt; me in VBA code.
gt;
gt; Thanks
gt;
gt; --
gt; Message posted via OfficeKB.com
gt; www.officekb.com/Uwe/Forums.a...excel/200605/1
I have tried this function but it still gives me errors. I get the E 15 error.
I am wondering how I can change this,

Bob Phillips wrote:
gt;Range(quot;A1quot;).Value = Right(Range(quot;A4quot;).Value,4)
gt;
gt;gt; I am using a macro to validate a form. I would like cell A1 to equate to the
gt;gt; last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
gt;gt; should have the value 4k00. I would be grateful if you could provide this to
gt;gt; me in VBA code.
gt;gt;
gt;gt; Thanks

--
Message posted via www.officekb.com

I think it'll depend on what's in those last 4 characters.

with Range(quot;A1quot;)
.numberformat = quot;@quot; 'make it text
.Value = Right(Range(quot;A4quot;).Text,4)
end with

quot;mohd21uk via OfficeKB.comquot; wrote:
gt;
gt; I have tried this function but it still gives me errors. I get the E 15 error.
gt; I am wondering how I can change this,
gt;
gt; Bob Phillips wrote:
gt; gt;Range(quot;A1quot;).Value = Right(Range(quot;A4quot;).Value,4)
gt; gt;
gt; gt;gt; I am using a macro to validate a form. I would like cell A1 to equate to the
gt; gt;gt; last four charecters of cell a4. For e.g if cell a1 is 552004k00 cell a4
gt; gt;gt; should have the value 4k00. I would be grateful if you could provide this to
gt; gt;gt; me in VBA code.
gt; gt;gt;
gt; gt;gt; Thanks
gt;
gt; --
gt; Message posted via www.officekb.com

--

Dave Peterson

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()