![]() |
Macro - copy cell contents IF
Hope you can help, need to move a value in one cell to another only IF the
first cell is not empty. In a function it would be: in cell B2 - - - - =IF(C2="","",C2) What I have now: Col1 Col2 AAA BBB CCC What I would like to end up with: Col1 Col2 AAA AAA BBB BBB CCC CCC Thanks in advance! |
Macro - copy cell contents IF
You already have the formula. What is the problem?
Glen |
Macro - copy cell contents IF
You could use a loop...see below Sub Loop() On Error Resume Next Dim r As Variant Dim WSN As Variant Set WSN = Thisworkbook.Sheets("Sheet1") 'put the sheet name here r = 1 Do If WSN.Cells(r, 1).Value = "" Then r = r + 1 Else: WSN.Cells(r, 2).Value = WSN.Cells(r, 1) r = r + 1 End If Loop End Sub This would do what you want...If you need more help, let me know... Scott Wagner Wrote: Hope you can help, need to move a value in one cell to another only IF the first cell is not empty. In a function it would be: in cell B2 - - - - =IF(C2="","",C2) What I have now: Col1 Col2 AAA BBB CCC What I would like to end up with: Col1 Col2 AAA AAA BBB BBB CCC CCC Thanks in advance! -- dok112 ------------------------------------------------------------------------ dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581 View this thread: http://www.excelforum.com/showthread...hreadid=513802 |
Macro - copy cell contents IF
Problem is, I need it in VBA instead of a function.
" wrote: You already have the formula. What is the problem? Glen |
Macro - copy cell contents IF
Is there a way to do this where I can be more specific?
Say only look at column F, and copy values to column D. Any ideas? |
All times are GMT +1. The time now is 09:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com