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!
Bookmarks