![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Jackson, MI
Posts: 88
|
I have the following:
AEP 28.92 DEL 28.00 ATSI 0 30.57 I need a DO LOOP that will look at column A, if the value in A is "AEP or DEL" put the value of B in a new column; if value in A is "ATSI" put the value of column C into the same column. Thanks a heap! |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,567
|
Hi gronkette1
You could try this code, it puts the data into column F (represented by 5 in the offset statements - change the 5 to the column number you want) For Each cell In Range("A:A") If cell.Value = "AEP" Or cell.Value = "DEL" Then cell.Offset(0, 5).Value = cell.Offset(0, 1).Value Else If cell.Value = "ATSI" Then cell.Offset(0, 5).Value = cell.Offset(0, 2).Value End If End If Next End Sub Hope this helps regards Derek |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Jackson, MI
Posts: 88
|
thanks....
I give it a try. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
You don't need to do this in a macro.
Put this formula in column D or whichever you want: =IF(OR(A:A="AEP",A:A="DEL")=TRUE,B:B,IF(A:A="ATSI",C:C))
__________________
Kind regards, Al Chara |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Jackson, MI
Posts: 88
|
Works GREAT !!!
Thanks again..... |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|