Results 1 to 6 of 6

Add text to cells with existing content - with a challenging twist!

Threaded View

madjan Add text to cells with... 09-27-2011, 10:05 AM
tigeravatar Re: Add text to cells with... 09-27-2011, 10:51 AM
madjan Re: Add text to cells with... 09-27-2011, 11:05 AM
madjan Re: Add text to cells with... 09-29-2011, 08:37 AM
tigeravatar Re: Add text to cells with... 09-29-2011, 08:44 AM
madjan Re: Add text to cells with... 09-29-2011, 09:29 AM
  1. #1
    Registered User
    Join Date
    09-27-2011
    Location
    Stockholm, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    7

    Add text to cells with existing content - with a challenging twist!

    This is solved, check new problem down!

    Hi all!

    After intense googling I didn't find the solution to my problem which is why I'm asking for your help!

    I've got a macro which is running in a regular excel-file exported from one system. It is moving around columns and adding headlines to fit as an import into another system.
    In one column, AF, I want to add the string "Att: " before the already existing content.
    Since the number of rows differs from document to document I want it to add "Att: " (WITH content, if it's empty it shouldn't do anything) as long as column A has rows.

    I've got a similar code from another column;
       
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "Y"
    Range("C2").Select
    Range("C2", Range("C2").End(xlDown)).Name = "typeColRange"
    Selection.AutoFill Destination:=Range("C2:C" & Range("A" & Rows.Count).End(xlUp).Row)
    But this is replacing existing content and fills ALL cells in column C to "Y" on as many rows that there is in column A .

    In my new case every column is unique and the existing content should remain with the adding of "Att: ".
    I've tried:
    Range("AF2").Select
    ActiveCell.FormulaR1C1 = "Att: " & ActiveCell.Value
    Range("AF2", Range("AF2").End(xlDown)).Name = "typeColRange"
     Selection.AutoFill Destination:=Range("AF2:AF" & Range("A" & Rows.Count).End(xlUp).Row)
    But this only works for the first cell in the column ("AF2") and replaces that content into every other.

    Please use the same column-names, string-names etc. in your solution. All headlines
    are on row 1, the data starts att row 2 and should end when column A rows end.

    Does this make sense?

    Thanks in advance!


    This is solved, check new problem down!
    Last edited by madjan; 09-29-2011 at 09:30 AM. Reason: Solved again!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1