#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 226
Default if then question

I have two columns one(A) with continuous data from top to bottom, the other
(B) with simular data only dispersed randomly from top to bottom. What I
would like to do is replace the data in column A with the contents of column
B, only when there is data in the cell in column B, if there is no data I
want the data in column A left the way it is.
thanks in advance for the help.
Roger
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default if then question

One way.
Sub replaceifdata()
lr = Cells(Rows.Count, "b").End(xlUp).Row
For Each c In Range("b1:b" & lr)
If Len(Trim(c)) 0 Then c.Offset(, -1) = c
Next
End Sub

--
Don Guillett
SalesAid Software

"Roger" wrote in message
...
I have two columns one(A) with continuous data from top to bottom, the
other
(B) with simular data only dispersed randomly from top to bottom. What I
would like to do is replace the data in column A with the contents of
column
B, only when there is data in the cell in column B, if there is no data I
want the data in column A left the way it is.
thanks in advance for the help.
Roger


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default if then question

I have two columns one(A) with continuous data from top to bottom, the
other
(B) with simular data only dispersed randomly from top to bottom. What I
would like to do is replace the data in column A with the contents of
column
B, only when there is data in the cell in column B, if there is no data I
want the data in column A left the way it is.
thanks in advance for the help.


You can do that directly... Copy the range you want from column B, click the
matching start cell in column A, then select Paste Special from the Edit
menu item... on the Paste Special dialog box, select Values from the Paste
section, None from the Operation section and check mark the Skip Blanks
box... click OK and you are done.

Rick

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default if then question

Unless a blank in col B is NOT really a blank

I am newly returned to Excel after a long absence, so I am rusty. Can you
please tell me what you are referring to here? Thank you.

Rick



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default if then question

Test both with one of the cells in col B that has been contaminated by
touching the space bar so that is not really blank.

--
Don Guillett
SalesAid Software

"Rick Rothstein (MVP - VB)" wrote in
message ...
Unless a blank in col B is NOT really a blank


I am newly returned to Excel after a long absence, so I am rusty. Can you
please tell me what you are referring to here? Thank you.

Rick


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,202
Default if then question

Test both with one of the cells in col B that has been contaminated
by touching the space bar so that is not really blank.


Okay, I see what you were saying. If I smart, I would have guessed that was
what you meant by the Trim function call you made in your VBA code. Thanks
for getting back to me on this.

Rick

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
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM
And Question, (a&b, or just a) nastech Excel Discussion (Misc queries) 5 January 22nd 06 07:51 PM
tab question Benjamin Excel Discussion (Misc queries) 2 November 7th 05 07:04 PM
iif question JMorrell Excel Discussion (Misc queries) 2 February 8th 05 11:09 PM


All times are GMT +1. The time now is 08:35 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"