Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
jesmin
 
Posts: n/a
Default Getting wrong value due to ref?


Hi Anyone:
I have 2 worksheets.
Sheet1:
-----Col:
RN:-A--B--C---D
1----2--4--""---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("Sheet2).Range("B5:E5).Value
="=If('Sheet1'!A1:D1="""",0,'Sheet1'!A1:D1)"

--Why the code is giving wrong results.

Thanks a lot for any help.


--
jesmin
------------------------------------------------------------------------
jesmin's Profile: http://www.excelforum.com/member.php...o&userid=29540
View this thread: http://www.excelforum.com/showthread...hreadid=522898

  #2   Report Post  
Posted to microsoft.public.excel.misc
George
 
Posts: n/a
Default Getting wrong value due to ref?

You have missed a few quote marks (after Sheet2 and B5:E5)
And you dont need the A1:D1 just the A1,
Excel will adjust the formula as it copies across

Try this:
Sheets("Sheet2").Range("B5:E5").Value = _
"=If('Sheet1'!A1="""",0,'Sheet1'!A1)"

George

jesmin wrote:
Hi Anyone:
I have 2 worksheets.

I wrote down in VB:
Sheets("Sheet2).Range("B5:E5).Value
="=If('Sheet1'!A1:D1="""",0,'Sheet1'!A1:D1)"

--Why the code is giving wrong results.

Thanks a lot for any help.


  #3   Report Post  
Posted to microsoft.public.excel.misc
jesmin
 
Posts: n/a
Default Getting wrong value due to ref?


Thanks a lot George. Its working. Frankly, I spent a huge time to
figure it out.


--
jesmin
------------------------------------------------------------------------
jesmin's Profile: http://www.excelforum.com/member.php...o&userid=29540
View this thread: http://www.excelforum.com/showthread...hreadid=522898

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot table pulling wrong value RestlessAde Excel Discussion (Misc queries) 2 February 16th 11 07:17 PM
excel formula calculations are wrong Shamroq Excel Worksheet Functions 4 February 8th 06 11:49 AM
SUMPRODUCT is showing wrong Amount msbutton27 Excel Discussion (Misc queries) 2 January 25th 06 03:40 PM
hyperlink navigation path path wrong in Excel 2003 CE Admin Excel Discussion (Misc queries) 5 January 7th 06 07:47 PM
Password box to remain open after wrong input Twanny Excel Discussion (Misc queries) 4 September 1st 05 09:29 PM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"