Hi Anyone:
I have 2 worksheets.
Sheet1:
-----Col:
RN:-A--B--C---D
1----2--4--quot;quot;---8
Cell C1 has a blank data. I want to copy this data into sheet2 starting
from colB to colE at row num 5 as follows. The blank data to be replaced
by 0.
Sheet2:
-----Col:
RN:-A--B--C--D--E
5-------2---4--0--8
I wrote down in VB:
Sheets(quot;Sheet2).Range(quot;B5:E5).Value
=quot;=If('Sheet1'!A11=quot;quot;quot;quot;,0,'Sheet1'!A11)quot;
--Why the code is giving wrong results.
Thanks a lot for any help.--
jesmin
------------------------------------------------------------------------
jesmin's Profile: www.excelforum.com/member.php...oamp;userid=29540
View this thread: www.excelforum.com/showthread...hreadid=522898You have missed a few quote marks (after Sheet2 and B5:E5)
And you dont need the A11 just the A1,
Excel will adjust the formula as it copies across
Try this:
Sheets(quot;Sheet2quot;).Range(quot;B5:E5quot;).Value = _
quot;=If('Sheet1'!A1=quot;quot;quot;quot;,0,'Sheet1'!A1)quot;
George
jesmin wrote:
gt; Hi Anyone:
gt; I have 2 worksheets.
gt;
gt; I wrote down in VB:
gt; Sheets(quot;Sheet2).Range(quot;B5:E5).Value
gt; =quot;=If('Sheet1'!A11=quot;quot;quot;quot;,0,'Sheet1'!A11)quot;
gt;
gt; --Why the code is giving wrong results.
gt;
gt; Thanks a lot for any help.
gt;
gt;
Thanks a lot George. Its working. Frankly, I spent a huge time to
figure it out.--
jesmin
------------------------------------------------------------------------
jesmin's Profile: www.excelforum.com/member.php...oamp;userid=29540
View this thread: www.excelforum.com/showthread...hreadid=522898
- Apr 13 Sun 2008 20:43
Getting wrong value due to ref?
close
全站熱搜
留言列表
發表留言