I am a bit confused with your question. 

This is what I am able to come up with so far. 

maybe you might be able to understand what I am trying to do from the code. 

So I was able to come up with this but it is not placing the value in same 
come as the word type

    Dim colLast As Long
Dim Rng As Range, rCell As Range

    'For first row. To change rows, alter the Cells number
colLast = Cells(1, Columns.Count).End(xlToLeft).Column


'Now for some data:
Cells(1, colLast + 1) = "TYPE"
    Cells(2, colLast).Select
 Set Rng = Range("I2:I" & Cells(Rows.Count, "B").End(xlUp).Row)
     For Each rCell In Rng.Cells
If rCell.Value = "FUEL2" Then rCell.Offset(0, colLast + 1).Value = "Fuel"
        If rCell.Value = "ELEC" Then rCell.Offset(0, colLast + 1).Value = 
"utility"
        If rCell.Value = "GAS" Then rCell.Offset(0, colLast + 1).Value = 
"TEST"
    
    Next rCell

How do   I also incorporate this to include it in next column after TYPE. 

Cells(1, colLast + 1) = "PMG"

    If Left(rCell.Value, 4) = "6183" Then
    rCell.Offset(0, 1).Value = "AEP"
    Else
    rCell.Offset(0, 1).Value = "ERP"

On Wednesday, February 24, 2016 at 1:35:02 PM UTC-5, Paul Schreiner wrote:

> I'm sorry, I STILL do not understand.
>
> How does the value in column "J" determine the value to display in column 
> "O"?
>
> as for "empty" rows.
> How can a row be empty if it has a value or something in it?
> If it has something in it, it is not empty.
> If it is empty, it doesn't have anything in it!?
>
> I suspect I'm missing something in your explanation.
>
> *Paul*
> -----------------------------------------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you 
> can,In all the places you can,At all the times you can,To all the people 
> you can,As long as ever you can.” - John Wesley*
> -----------------------------------------
>
>
> On Wednesday, February 24, 2016 11:19 AM, Maju <betm...@gmail.com 
> <javascript:>> wrote:
>
>
>
> I am using 2010 excel. 
>
> I have attached a file. The value in column J will determine what will go 
> into o. So I don't have the value for column o stored any where. 
>
> what I mean by delete row. Is to clean up the rows after the last row with 
> data. Sometimes some rows might be empty but have in value or something 
> that will make it thing that there is value. 
>
> thanks!
>
> It would be helpful to provide a sample file.
> But:
> What version of Excel are you using?
>
> Where do you get the values for column "O"? 
> Your example has entering "utility" when something other than "fuel" is in 
> column J.
> Are there other values?
>
> And, what so you mean by "Delete any extra line after the last row with 
> data."?
> Excel 2010 allows 1,048,576 rows.
> You cannot "delete" any of these rows.
> You can delete the CONTENTS, but the rows are still there.
> However, you can HIDE any or all of these rows.
>
> Can you please elaborate?
>
> *Paul*
> ------------------------------ -----------
>
>
>
>
>
>
>
> *“Do all the good you can,By all the means you can,In all the ways you 
> can,In all the places you can,At all the times you can,To all the people 
> you can,As long as ever you can.” - John 
> Wesley*------------------------------ 
> -----------
>
>
> On Tuesday, February 23, 2016 8:48 AM, Maju <betm...@gmail.com> wrote:
>
>
>
> Hello All,
>
> Please I need help with the below macro.
> I have a worksheet with lots of data.
>
>    1. I want to go through each cell in column J. 
>    To find data and put the answer in column O. 
>    2. Then left and Right trim spaces
>    3. Delete any extra line after the last row with data.
>    4. Save file as expense with a date attached to it.
>    
>
> The below should be the final result. 
>  
>  
> Column J                                                          Column 
> O 
> Fuel                                                                   
> Fuel     
> Gas                                                                    
> Utility
> Electric                                                             
> Utility
> Fuel                                                                   
> Fuel     
>
> Your help will be greatly appreciated
>
> thanks!!
> -- 
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
> https://www.facebook.com/discussexcel
>  
> FORUM RULES
>  
> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security 
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>  
> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
> members are not responsible for any loss.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to excel-macros...@ googlegroups.com.
> To post to this group, send email to excel-...@googlegroups.com.
>
> Visit this group at https://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
> https://www.facebook.com/discussexcel
>  
> FORUM RULES
>  
> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security 
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>  
> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
> members are not responsible for any loss.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to excel-macros...@googlegroups.com <javascript:>.
> To post to this group, send email to excel-...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at https://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to